Re: Optimizer picks an ineffient plan

From: Peter Childs <blue(dot)dragon(at)blueyonder(dot)co(dot)uk>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Optimizer picks an ineffient plan
Date: 2003-09-04 10:26:40
Message-ID: Pine.LNX.4.44.0309041123010.5333-100000@RedDragon.Childs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 4 Sep 2003, Tom Lane wrote:

> Greg Stark <gsstark(at)mit(dot)edu> writes:
> > Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> >> Yes, that's the real crux of the matter. Should the optimizer spend
> >> cycles on *every* query to detect cases where the user has written
> >> useless sort keys? I've got grave doubts that it's a win.
>
> > Well I'm sure the same arguments were made 30 years ago about optimizing
> > compilers. But thankfully the optimizer-geeks won the argument.
>
> Um ... I *am* an optimizer-geek. You can find my name in the credits
> for Bliss/11, which was the best optimizing compiler on the planet about
> thirty years ago. I stand by my comment that there's a tradeoff between
> the potential gain from an optimization and the time spent to find it.
>
> PG is at a disadvantage compared to typical compilation scenarios, in
> that a compiler assumes its output will be executed many times, while
> SQL queries often are planned and then executed but once. There's been
> some talk of working harder when planning a "prepared statement", but
> so far I've not seen very many places where I'd really want to alter
> the planner's behavior on that basis.
>

An intresting point. Perhaps storing some stats on Views would
help. Maybe adding a cache facility for views would speed some things up.
I don't really see anything against storing stats on "Prepared
Statements" and Views like we do on Tables.
Maybe indexs on View would be useful but keeping them uptodate
would be a hazard.

Peter Childs

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bjorn T Johansen 2003-09-04 10:30:56 Re: Tomcat Connection Pool?
Previous Message Csaba Nagy 2003-09-04 10:17:35 Re: Replaceing records