Re: Planner cost adjustments - Mailing list pgsql-general

From Tomas Vondra
Subject Re: Planner cost adjustments
Date
Msg-id 556891CA.7090804@2ndquadrant.com
Whole thread Raw
In response to Re: Planner cost adjustments  (Melvin Davidson <melvin6925@gmail.com>)
List pgsql-general
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


pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: Re: Planner cost adjustments
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] Re: 9.4.1 -> 9.4.2 problem: could not access status of transaction 1