Re: SELECT .. WHERE id IN(..)
От | Samuel Smith |
---|---|
Тема | Re: SELECT .. WHERE id IN(..) |
Дата | |
Msg-id | 55581DE1.70709@net153.net обсуждение исходный текст |
Ответ на | SELECT .. WHERE id IN(..) (Maks Materkov <materkov@gmail.com>) |
Ответы |
Re: SELECT .. WHERE id IN(..)
|
Список | pgsql-general |
On 05/16/2015 10:44 PM, Maks Materkov wrote: > I have a database, table "users", with column "profile_id", and the > following query: > > > EXPLAIN ANALYZE SELECT * FROM users_user WHERE profile_id IN (...50 ids...); > > > Result: > > > Index Scan using users_user_83a0eb3f on users_user (cost=0.50..292.22 > rows=50 > > width=633) (actual time=0.039..0.622 rows=44 loops=1) > > Index Cond: (profile_id = ANY ('{2445564,... 50 ids....}'::integer[])) > > Planning time: 0.322 ms > > Execution time: 5192.321 ms > > This query takes ~5 seconds. (about ~5 million rows in table). I have a > btree index on this column. Is there any way to speed up query? > That does not seem right. Try again only using 'EXPLAIN (ANALYZE 1,BUFFERS 1)' Also what version are you on and what are shared_buffers set to? --Sam
В списке pgsql-general по дате отправления: