Re: vacuum -vs reltuples on insert only index

2020-11-09 Thread Jehan-Guillaume de Rorthais
On Wed, 4 Nov 2020 18:44:03 -0800 Peter Geoghegan wrote: > On Mon, Nov 2, 2020 at 10:03 AM Peter Geoghegan wrote: > > Actually, it seems better to always count num_index_tuples the old way > > during cleanup-only index VACUUMs, despite the inaccuracy that that > > creates with posting list tuple

Re: vacuum -vs reltuples on insert only index

2020-11-04 Thread Peter Geoghegan
On Mon, Nov 2, 2020 at 10:03 AM Peter Geoghegan wrote: > Actually, it seems better to always count num_index_tuples the old way > during cleanup-only index VACUUMs, despite the inaccuracy that that > creates with posting list tuples. Pushed a fix for this just now. Thanks for the report! -- Pet

Re: vacuum -vs reltuples on insert only index

2020-11-02 Thread Peter Geoghegan
Just one more postscript... On Mon, Nov 2, 2020 at 12:06 PM Peter Geoghegan wrote: > Just to be clear: I am not proposing that we set > 'IndexBulkDeleteResult.estimated_count = false' here I meant 'IndexBulkDeleteResult.estimated_count = true'. So my patch doesn't touch that field at all. > In

Re: vacuum -vs reltuples on insert only index

2020-11-02 Thread Peter Geoghegan
On Mon, Nov 2, 2020 at 10:03 AM Peter Geoghegan wrote: > Attached is my proposed fix, which takes this approach. I will commit > this on Wednesday or Thursday, barring any objections. Just to be clear: I am not proposing that we set 'IndexBulkDeleteResult.estimated_count = false' here, even thoug

Re: vacuum -vs reltuples on insert only index

2020-11-02 Thread Peter Geoghegan
On Fri, Oct 23, 2020 at 11:10 AM Peter Geoghegan wrote: > I suspect that we need to move in this direction within nbtree. I'm a > bit concerned about the partial index problem, though. I suppose maybe > we could do it the old way (which won't account for posting list > tuples) during cleanup as yo

Re: vacuum -vs reltuples on insert only index

2020-10-23 Thread Peter Geoghegan
On Fri, Oct 23, 2020 at 8:51 AM Jehan-Guillaume de Rorthais wrote: > Before 0d861bbb70, btvacuumpage was adding to relation stats the number of > leaving lines in the block using: > > stats->num_index_tuples += maxoff - minoff + 1; > > After 0d861bbb70, it is set using new variable nhtidslive: >

vacuum -vs reltuples on insert only index

2020-10-23 Thread Jehan-Guillaume de Rorthais
Hello, I've found a behavior change with pg_class.reltuples on btree index. With only insert activity on a table, when an index is processed, its related reltuples is set to 0. Here is a demo script: -- force index cleanup set vacuum_cleanup_index_scale_factor to 0; drop table if exists t;