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