2011/11/29 Tyler Hains <thains@xxxxxxxxxxxxxxxxxx>: > # explain analyze select * from cards where card_set_id=2850 order by > card_id limit 1; > QUERY PLAN > ----------------------------------------------------------------------------------------------------------------------------------------- > Limit (cost=0.00..105.19 rows=1 width=40) (actual time=6026.947..6026.948 > rows=1 loops=1) > -> Index Scan using cards_pkey on cards (cost=0.00..2904875.38 > rows=27616 width=40) (actual time=6026.945..6026.945 rows=1 loops=1) > Filter: (card_set_id = 2850) > Total runtime: 6026.985 ms do you have autovacum enabled? does the plan change when you push stats target for this column? ALTER TABLE cards ALTER card_set_id SET STATISTICS 500; ANALYZE cards ( card_set_id ); what happens when you do: select * from ( select * from cards where card_set_id=2850 ) order by card_id limit 1 ? -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general