Re: 512,600ms query becomes 7500ms... but why? Postgres 8.3 query planner quirk? - Mailing list pgsql-performance

From Bryce Nesbitt
Subject Re: 512,600ms query becomes 7500ms... but why? Postgres 8.3 query planner quirk?
Date
Msg-id 4B765893.9080600@obviously.com
Whole thread Raw
In response to Re: 512,600ms query becomes 7500ms... but why? Postgres 8.3 query planner quirk?  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-performance


Kevin Grittner wrote:
Bryce Nesbitt <bryce2@obviously.com> wrote: 
I've got a very slow query, which I can make faster by doing
something seemingly trivial.    
 
Out of curiosity, what kind of performance do you get with?:
EXPLAIN ANALYZE
SELECT contexts.context_key FROM contexts JOIN articles ON (articles.context_key = contexts.context_key) JOIN matview_82034 ON (matview_82034.context_key =                        contexts.context_key) WHERE EXISTS       (         SELECT *           FROM article_words           JOIN words using (word_key)           WHERE context_key = contexts.context_key             AND word = 'insider'       )   AND EXISTS       (         SELECT *           FROM article_words           JOIN words using (word_key)           WHERE context_key = contexts.context_key             AND word = 'trading'       )   AND EXISTS       (         SELECT *           FROM virtual_ancestors a           JOIN bp_categories ON (bp_categories.context_key =                                  a.ancestor_key)           WHERE a.context_key = contexts.context_key             AND lower(bp_categories.category) = 'law'       )   AND articles.indexed
; 
512,600ms query becomes 225,976ms.  Twice as fast on pos
Definitely not beating the 7500ms version.
PostgreSQL 8.3.4




pgsql-performance by date:

Previous
From: Greg Smith
Date:
Subject: Re: Dell PERC H700/H800
Next
From: Bryce Nesbitt
Date:
Subject: Re: Re: 512,600ms query becomes 7500ms... but why? Postgres 8.3 query planner quirk?