Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-performance by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group