Re: Overriding the optimizer - Mailing list pgsql-performance

From Jim C. Nasby
Subject Re: Overriding the optimizer
Date
Msg-id 20051216223846.GV53809@pervasive.com
Whole thread Raw
In response to Re: Overriding the optimizer  (Kevin Brown <kevin@sysexperts.com>)
List pgsql-performance
On Thu, Dec 15, 2005 at 09:48:55PM -0800, Kevin Brown wrote:
> Craig A. James wrote:
> > Kevin Brown wrote:
> > >>Hints are dangerous, and I consider them a last resort.
> > >
> > >If you consider them a last resort, then why do you consider them to
> > >be a better alternative than a workaround such as turning off
> > >enable_seqscan, when all the other tradeoffs are considered?
> >
> > If I understand enable_seqscan, it's an all-or-nothing affair.  Turning it
> > off turns it off for the whole database, right?  The same is true of all
> > of the planner-tuning parameters in the postgres conf file.
>
> Nope.  What's in the conf file are the defaults.  You can change them
> on a per-connection basis, via the SET command.  Thus, before doing
> your problematic query:
>
> SET enable_seqscan = off;
>
> and then, after your query is done,
>
> SET enable_seqscan = on;

You can also turn it off inside a transaction and have it only affect
that transaction so that you can't accidentally forget to turn it back
on (which could seriously hose things up if you're doing this in
conjunction with a connection pool).
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

pgsql-performance by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: SAN/NAS options
Next
From: "Jim C. Nasby"
Date:
Subject: Re: Overriding the optimizer