Re: Determining scan types - Mailing list pgsql-general

From Richard Huxton
Subject Re: Determining scan types
Date
Msg-id 3B42B859.52D7405D@archonet.com
Whole thread Raw
In response to Determining scan types  (Philip Molter <philip@datafoundry.net>)
Responses Re: Determining scan types  (Philip Molter <philip@datafoundry.net>)
List pgsql-general
Philip Molter wrote:

> : For the purposes of setting SEQSCAN try something like:
> :
> : SET ENABLE_SEQSCAN TO OFF;
>
> Well, I turned it off for the entire database (since right now, we're
> only using the db for this one application), but I lose the benefit of
> seqscans in situations where it's appropriate.  That's why I was
> wondering if there's anyway to tell the optimizer to prefer index scans
> over sequential scans when it has a choice.

AFAIK that's exactly what ENABLE_SEQSCAN does.

> Right now, it's using less
> efficient joining methods where it would normally use sequential scans
> (not that I'm complaining too much; CPU performance has more than
> doubled since taking out sequential scans).

Try wrapping the one or two key queries with ...OFF and ...ON - should
give you the best of both worlds.

I've always managed to persuade PG to make the "right" choices, but
there are a whole set of parameters you can tweak if absolutely
necessary. The ENABLE_SEQSCAN is a pretty blunt tool but is the easiest
for (me :-) to understand. See the runtime configuration chapter for
details and check the mail archives for examples of use.

- Richard Huxton

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Please add to TODO list
Next
From: "Mourad EL HADJ MIMOUNE"
Date:
Subject: ERROR: fmgr_info: function 0: cache lookup failed