Re: Overriding the optimizer - Mailing list pgsql-performance

From Mark Kirkwood
Subject Re: Overriding the optimizer
Date
Msg-id 43A226E7.7040508@paradise.net.nz
Whole thread Raw
In response to Overriding the optimizer  ("Craig A. James" <cjames@modgraph-usa.com>)
Responses Re: Overriding the optimizer  ("Craig A. James" <cjames@modgraph-usa.com>)
Re: Overriding the optimizer  ("Jim C. Nasby" <jnasby@pervasive.com>)
List 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

pgsql-performance by date:

Previous
From: "Craig A. James"
Date:
Subject: Re: Overriding the optimizer
Next
From: Christopher Kings-Lynne
Date:
Subject: Re: Overriding the optimizer