Re: [SQL] SQL Query Optimization

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dav Coleman <dav(at)danger-island(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [SQL] SQL Query Optimization
Date: 2002-04-18 16:24:57
Message-ID: 12955.1019147097@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dav Coleman <dav(at)danger-island(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2002-04-18 16:33:48 Re: [HACKERS] build of 7.2.1 on SCO Openserver and Unixware
Previous Message Christopher Browne 2002-04-18 16:11:13 Re: new food for the contrib/ directory