Re: [HACKERS] Some notes on optimizer cost estimates
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Hiroshi Inoue <Inoue@tpf.co.jp>, pgsql-hackers@postgresql.org
Date: 2000-01-21T03:10:28Z
Lists: pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes: > It is nice that ANALYZE is done during vacuum. I can't imagine why you > would want to do an analyze without adding a vacuum to it. I guess > that's why I made them the same command. Well, the main bad thing about ANALYZE being part of VACUUM is that it adds to the length of time that VACUUM is holding an exclusive lock on the table. I think it'd make more sense for it to be a separate command. I have also been thinking about how to make ANALYZE produce a more reliable estimate of the most common value. The three-element list that it keeps now is a good low-cost hack, but it really doesn't produce a trustworthy answer unless the MCV is pretty darn C (since it will never pick up on the MCV at all until there are at least two occurrences in three adjacent tuples). The only idea I've come up with is to use a larger list, which would be slower and take more memory. I think that'd be OK in a separate command, but I hesitate to do it inside VACUUM --- VACUUM has its own considerable memory requirements, and there's still the issue of not holding down an exclusive lock longer than you have to. regards, tom lane