Re: Planner cost adjustments

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Planner cost adjustments
Date: 2015-05-29 16:20:26
Message-ID: 556891CA.7090804@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Arup Rakshit 2015-05-29 16:32:07 Between with a list of ranges possible ?
Previous Message Melvin Davidson 2015-05-29 15:22:18 Re: Planner cost adjustments