Re: [SQL] SQL Query Optimization - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [SQL] SQL Query Optimization
Date
Msg-id 12955.1019147097@sss.pgh.pa.us
Whole thread Raw
In response to Re: [SQL] SQL Query Optimization  (Dav Coleman <dav@danger-island.com>)
List pgsql-hackers
Dav Coleman <dav@danger-island.com> writes:
> But basically I haven't done any ANALYZE or EXPLAIN yet because of the 
> fact that the order -is- making a difference so it can't be executing
> the same query inside the database engine.

If you haven't ever done VACUUM ANALYZE then the planner is flying
completely blind as to table sizes and data distributions.  This would
(among other things) very possibly allow different plans to be estimated
as exactly the same cost --- since all the cost numbers will be based on
exactly the same default statistics.  So it's not surprising that you'd
get an arbitrary choice of plans depending on trivial details like
WHERE clause order.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Christopher Browne
Date:
Subject: Re: new food for the contrib/ directory
Next
From: Thomas Lockhart
Date:
Subject: Re: new food for the contrib/ directory