Re: New IndexAM API controlling index vacuum strategies
Masahiko Sawada <sawada.mshk@gmail.com>
From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Andres Freund <andres@anarazel.de>, Robert Haas <robertmhaas@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>,
Noah Misch <noah@leadboat.com>
Date: 2021-04-01T01:43:41Z
Lists: pgsql-hackers
On Thu, Apr 1, 2021 at 9:58 AM Peter Geoghegan <pg@bowt.ie> wrote: > > On Wed, Mar 31, 2021 at 4:45 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > Both 0001 and 0002 patch refactors the whole lazy vacuum code. Can we > > merge them? I basically agree with the refactoring made by 0001 patch > > but I'm concerned a bit that having such a large refactoring at very > > close to feature freeze could be risky. We would need more eyes to > > review during stabilization. > > I think that Robert makes some related points about how we might cut > scope here. So I'll definitely do some of that, maybe all of it. > > > I think it's more clear to use this macro. The macro can be like this: > > > > ParallelVacuumIsActive(vacrel) (((LVRelState) vacrel)->lps != NULL) > > Yes, that might be better. I'll consider it when I get back to the > patch tomorrow. > > > + * LVDeadTuples stores TIDs that are gathered during pruning/the initial heap > > + * scan. These get deleted from indexes during index vacuuming. They're then > > + * removed from the heap during a second heap pass that performs heap > > + * vacuuming. > > */ > > > > The second sentence of the removed lines still seems to be useful > > information for readers? > > I don't think that the stuff about shared memory was useful, really. > If we say something like this then it should be about the LVRelState > pointer, not the struct. Understood. > > --- > > + /* Stop applying cost limits from this point on */ > > + VacuumCostActive = false; > > + VacuumCostBalance = 0; > > + } > > > > I agree with the idea of disabling vacuum delay in emergency cases. > > But why do we do that only in the case of the table with indexes? I > > think this optimization is helpful even in the table with no indexes. > > We can check the XID wraparound emergency by calling > > vacuum_xid_limit_emergency() at some point to disable vacuum delay? > > Hmm. I see your point, but at the same time I think that the risk is > lower on a table that has no indexes. It may be true that index > vacuuming doesn't necessarily take the majority of all of the work in > lots of cases. But I think that it is true that it does when things > get very bad -- one-pass/no indexes VACUUM does not care about > maintenance_work_mem, etc. Agreed. > > But let me think about it...I suppose we could do it when one-pass > VACUUM considers vacuuming a range of FSM pages every > VACUUM_FSM_EVERY_PAGES. That's kind of similar to index vacuuming, in > a way -- it wouldn't be too bad to check for emergencies in the same > way there. Yeah, I also thought that would be a good place to check for emergencies. That sounds reasonable. Regards, -- Masahiko Sawada EDB: https://www.enterprisedb.com/
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Don't truncate heap when VACUUM's failsafe is in effect.
- 60f1f09ff443 14.0 landed
-
Teach VACUUM to bypass unnecessary index vacuuming.
- 5100010ee4d5 14.0 landed
-
Add wraparound failsafe to VACUUM.
- 1e55e7d1755c 14.0 landed
-
Truncate line pointer array during VACUUM.
- 3c3b8a4b2689 14.0 landed
-
Remove tupgone special case from vacuumlazy.c.
- 8523492d4e34 14.0 landed
-
Refactor lazy_scan_heap() loop.
- 7ab96cf6b312 14.0 landed
-
Propagate parallel VACUUM's buffer access strategy.
- 49f49defe7c0 14.0 cited
-
Simplify state managed by VACUUM.
- b4af70cb2103 14.0 landed
-
Notice that heap page has dead items during VACUUM.
- 0ea71c93a06d 14.0 landed
-
Adjust lazy_scan_heap() accounting comments.
- 7cde6b13a9b6 14.0 cited
-
Use full 64-bit XID for checking if a deleted GiST page is old enough.
- 6655a7299d83 13.0 cited
-
Fix some problems with VACUUM (INDEX_CLEANUP FALSE).
- dd6959798885 12.0 cited