Re: Overriding the optimizer

From: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
To: "Craig A(dot) James" <cjames(at)modgraph-usa(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Overriding the optimizer
Date: 2005-12-16 02:31:03
Message-ID: 43A226E7.7040508@paradise.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Craig A. James wrote:
> I asked a while back if there were any plans to allow developers to
> override the optimizer's plan and force certain plans, and received a
> fairly resounding "No". The general feeling I get is that a lot of work
> has gone into the optimizer, and by God we're going to use it!
>
> I think this is just wrong, and I'm curious whether I'm alone in this
> opinion.
>
> Over and over, I see questions posted to this mailing list about
> execution plans that don't work out well. Many times there are good
> answers - add an index, refactor the design, etc. - that yield good
> results. But, all too often the answer comes down to something like
> this recent one:
>
> > Right on. Some of these "coerced" plans may perform > much better.
> If so, we can look at tweaking your runtime
> > config: e.g.
> >
> > effective_cache_size
> > random_page_cost
> > default_statistics_target
> >
> > to see if said plans can be chosen "naturally".
>
> I see this over and over. Tweak the parameters to "force" a certain
> plan, because there's no formal way for a developer to say, "I know the
> best plan."
>

I hear what you are saying, but to use this fine example - I don't know
what the best plan is - these experiments part of an investigation to
find *if* there is a better plan, and if so, why Postgres is not finding it.

> There isn't a database in the world that is as smart as a developer, or
> that can have insight into things that only a developer can possibly
> know.

That is often true - but the aim is to get Postgres's optimizer closer
to developer smartness.

After years of using several other database products (some supporting
hint type constructs and some not), I have come to believe that hinting
(or similar) actually *hinders* the development of a great optimizer.

Best wishes

Mark

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Kings-Lynne 2005-12-16 02:34:38 Re: Overriding the optimizer
Previous Message Christopher Kings-Lynne 2005-12-16 02:25:22 Re: Overriding the optimizer