Re: [HACKERS] Optimizer badness in 7.0 beta - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] Optimizer badness in 7.0 beta
Date
Msg-id Pine.LNX.4.21.0003051506410.347-100000@localhost.localdomain
Whole thread Raw
In response to Optimizer badness in 7.0 beta  (Brian Hirt <bhirt@mobygames.com>)
Responses Re: [HACKERS] Optimizer badness in 7.0 beta
List pgsql-hackers
This query can be rewritten as

SELECT creation_timestamp, etc. 
FROM game, game_developer
WHERE game.game_id = game_developer.game_id AND approved = 1 AND developer_id = 3
ORDER BY copyright_year desc, game_title

The way you're writing it you're almost asking it to be slow. :)

Of course that still doesn't explain why it's now 94sec versus formerly 1
but I'm sure Tom Lane will enlighten us all very soon. :)


Brian Hirt writes:

> select 
>     creation_timestamp,
[snip]
> from 
>     game 
> where 
>     approved = 1 
> and 
>     game_id in (
>         select 
>             distinct game_id
>         from 
>             game_developer
>         where 
>             developer_id = 3) 
> order by 
>     copyright_year desc,
>     game_title;


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] TransactionStateData and AbsoluteTime
Next
From: Brian Hirt
Date:
Subject: Re: [HACKERS] Optimizer badness in 7.0 beta