Re: query optimiser changes 6.5->7.0 - Mailing list pgsql-general

From Wim Ceulemans
Subject Re: query optimiser changes 6.5->7.0
Date
Msg-id 393778FC.ADE5346B@nice.be
Whole thread Raw
In response to query optimiser changes 6.5->7.0  ("Simon Hardingham" <simon@netxtra.net>)
Responses Re: query optimiser changes 6.5->7.0
List pgsql-general
Tom Lane wrote:
>
> Joseph Shraibman <jks@selectacast.net> writes:
> > OK this may seem like a stupid question, but isn't index scan always
> > better except for the pathalogical simple case where the work to be done
> > is trivial anyway?
>
> No.  If it were, the optimizer would be a whole lot simpler ;-)
>
> In practice an indexscan only wins if it will visit a relatively
> small percentage of the tuples in the table.  The $64 questions
> are how small is small enough, and how can the optimizer guess
> how many tuples will be hit in advance of doing the query...
>

Isn't there a way to tell the optimizer to use an index scan if one
knows this is going to be the best.

I have seen lots of posts concerning people who are trying to force the
optimizer to use an index scan by rephrasing their SQL statements. Isn't
there a possibility to provide some syntax (non SQL compliant I know) to
force the optimizer to do an index scan?

Regards
Wim

pgsql-general by date:

Previous
From: Merrill Oveson
Date:
Subject: deferred capability for the primary key
Next
From: Alfred Perlstein
Date:
Subject: Re: query optimiser changes 6.5->7.0