Re: Possible TODO item? VACUUM on empty table - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Possible TODO item? VACUUM on empty table
Date
Msg-id 87k6s8x4q5.fsf@stark.xeocode.com
Whole thread Raw
In response to Possible TODO item? VACUUM on empty table  (Richard Huxton <dev@archonet.com>)
Responses Re: Possible TODO item? VACUUM on empty table  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Richard Huxton <dev@archonet.com> writes:

> So - would it be worth, in the case of vacuum+analyse (but not analyse alone),
> where the table is completely empty then just halve the existing stats.
> 
> That way, if you're in the middle of a delete/replace cycle your stats will
> still be in the realms of reasonableness. On the other hand, if the table is
> genuinely empty and you're running a nightly vacuum the stats will tend toward
> 0.
> 
> Against the idea:
> 1. It's a special-case in the code

Hm. I suppose the generalization of this would be to always average the new
stats with the existing stats.

I suppose you could make the argument that if I run analyze and then run
analyze again without changing anything then I've effectively doubled the
sample size and the stats can take advantage of that.

But not all of the stats are simple totals. I'm not sure this would make sense
for the histogram arrays.

-- 
greg



pgsql-hackers by date:

Previous
From: "Pawel Niewiadomski"
Date:
Subject: Re: Bitmap index
Next
From: Yann Michel
Date:
Subject: Re: Bitmap index