Re: Overriding the optimizer

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Kevin Brown <kevin(at)sysexperts(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Overriding the optimizer
Date: 2005-12-16 22:38:46
Message-ID: 20051216223846.GV53809@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jim C. Nasby 2005-12-16 22:41:21 Re: Overriding the optimizer
Previous Message Jim C. Nasby 2005-12-16 22:19:09 Re: SAN/NAS options