Hi, On 05/29/15 17:22, Melvin Davidson wrote:
I have found that setting enable_seqscan = off will remedy that situation. Basically, it forces the planner to choose the index. However, if no correct index is available, it will use sequential scan anyway. The only time it will have a negative effect is if the seqscan is actually faster, which doesn't happen very often.
Actually, this is quite poor choice, exactly because it forces the planner to use indexscan even if seqscan would be much faster. The correct way to fix this is by tweaking cost variables, for example by setting random_page_cost = 2 (instead of default 4).
Sadly, the original post provides very little information about the context, e.g. database size, storage system, explain plans etc.
regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general