Re: 512,600ms query becomes 7500ms... but why? Postgres 8.3 query planner quirk?

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Karl Denninger" <karl(at)denninger(dot)net>
Cc: "Bryce Nesbitt" <bryce2(at)obviously(dot)com>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: 512,600ms query becomes 7500ms... but why? Postgres 8.3 query planner quirk?
Date: 2010-02-12 16:11:00
Message-ID: 4B752934020000250002F24E@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Karl Denninger <karl(at)denninger(dot)net> wrote:
Kevin Grittner wrote:

>> I suspect that the above might do pretty well in 8.4.

> "Exists" can be quite slow. So can "not exists"
>
> See if you can re-write it using a sub-select - just replace the
> "exists ...." with "(select ...) is not null"
>
> Surprisingly this often results in a MUCH better query plan under
> Postgresql. Why the planner evaluates it "better" eludes me (it
> shouldn't) but the differences are often STRIKING - I've seen
> factor-of-10 differences in execution performance.

Have you seen such a difference under 8.4? Can you provide a
self-contained example?

-Kevin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Karl Denninger 2010-02-12 16:43:10 Re: 512,600ms query becomes 7500ms... but why? Postgres 8.3 query planner quirk?
Previous Message Karl Denninger 2010-02-12 16:05:45 Re: 512,600ms query becomes 7500ms... but why? Postgres 8.3 query planner quirk?