-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Friday, April 05, 2002 3:42 PM
To: Peter Bierman
Cc: Dann Corbit; pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Suggestion for optimization 


Peter Bierman <bierman@apple.com> writes:
> ... Your comment: "An
> accurate cardinality figure can greatly enhance the optimizer's
> ability to perform joins in the correct order" was intriguing, and I'd
> be interested in Tom's thoughts on just that bit.

Approximate figures are quite sufficient for the planner's purposes.
AFAICS, making them exact would not improve the planning estimates
at all, because there are too many other sources of error.  We have
approximate stats already via vacuum/analyze statistics gathering.
>>
What happens if someone deletes 75% of a table?
What happens if someone imports 30 times more rows than are already in
the table?
What happens if one table is remarkably small or even empty and you are
unaware?

In extreme cases, it can mean orders of magnitude performance
difference.
<<

Fri, 5 Apr 2002 15:51:00 -0800
"Dann Corbit" <DCorbit@connx.com>
Re: Suggestion for optimization 
> AFAICS, making them exact would not improve the planning estimates
> at all, because there are too many other sources of error.  We have
> approximate stats already via vacuum/analyze statistics gathering.
> >>
> What happens if someone deletes 75% of a table?
> What happens if someone imports 30 times more rows than are already in
> the table?
> What happens if one table is remarkably small or even empty and you are
> unaware?

If you are unaware of any of the above, you'll get poorer performance.
Just make sure you run ANALYZE often enough.  Anyone who does a massive
change in the number of rows in a table, or updates most of a table should
always do an ANALYZE afterwards.

Chris



Sat, 6 Apr 2002 18:43:27 +0800 (WST)
Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Re: Suggestion for optimization 