Re: Combine Prune and Freeze records emitted by vacuum

2024-04-03 Thread Peter Geoghegan
On Wed, Apr 3, 2024 at 1:04 PM Melanie Plageman wrote: > Thanks! And thanks for updating the commitfest entry! Nice work! -- Peter Geoghegan

Re: Combine Prune and Freeze records emitted by vacuum

2024-04-03 Thread Melanie Plageman
On Wed, Apr 3, 2024 at 12:34 PM Heikki Linnakangas wrote: > > On 03/04/2024 17:18, Melanie Plageman wrote: > > I noticed you didn't make the comment updates I suggested in my > > version 13 here [1]. A few of them are outdated references to > > heap_page_prune() and one to a now deleted variable

Re: Combine Prune and Freeze records emitted by vacuum

2024-04-03 Thread Heikki Linnakangas
On 03/04/2024 17:18, Melanie Plageman wrote: I noticed you didn't make the comment updates I suggested in my version 13 here [1]. A few of them are outdated references to heap_page_prune() and one to a now deleted variable name (all_visible_except_removable). I applied them to your v13 and

Re: Combine Prune and Freeze records emitted by vacuum

2024-04-03 Thread Melanie Plageman
On Wed, Apr 3, 2024 at 8:39 AM Heikki Linnakangas wrote: > > On 02/04/2024 16:11, Heikki Linnakangas wrote: > > On 01/04/2024 20:22, Melanie Plageman wrote: > >> Review for 0003-0006 (I didn't have any new thoughts on 0002). I know > >> you didn't modify them much/at all, but I noticed some

Re: Combine Prune and Freeze records emitted by vacuum

2024-04-03 Thread Heikki Linnakangas
On 02/04/2024 16:11, Heikki Linnakangas wrote: On 01/04/2024 20:22, Melanie Plageman wrote: Review for 0003-0006 (I didn't have any new thoughts on 0002). I know you didn't modify them much/at all, but I noticed some things in my code that could be better. Ok, here's what I have now. I made a

Re: Combine Prune and Freeze records emitted by vacuum

2024-04-02 Thread Melanie Plageman
On Tue, Apr 02, 2024 at 01:24:27PM -0400, Melanie Plageman wrote: > On Tue, Apr 2, 2024 at 9:11 AM Heikki Linnakangas wrote: > > > > On 01/04/2024 20:22, Melanie Plageman wrote: > > > Review for 0003-0006 (I didn't have any new thoughts on 0002). I know > > > you didn't modify them much/at all,

Re: Combine Prune and Freeze records emitted by vacuum

2024-04-02 Thread Melanie Plageman
On Tue, Apr 2, 2024 at 9:11 AM Heikki Linnakangas wrote: > > On 01/04/2024 20:22, Melanie Plageman wrote: > > Review for 0003-0006 (I didn't have any new thoughts on 0002). I know > > you didn't modify them much/at all, but I noticed some things in my code > > that could be better. > > Ok, here's

Re: Combine Prune and Freeze records emitted by vacuum

2024-04-02 Thread Heikki Linnakangas
On 01/04/2024 20:22, Melanie Plageman wrote: Review for 0003-0006 (I didn't have any new thoughts on 0002). I know you didn't modify them much/at all, but I noticed some things in my code that could be better. Ok, here's what I have now. I made a lot of small comment changes here and there,

Re: Combine Prune and Freeze records emitted by vacuum

2024-04-01 Thread Heikki Linnakangas
On 01/04/2024 20:22, Melanie Plageman wrote: From 17e183835a968e81daf7b74a4164b243e2de35aa Mon Sep 17 00:00:00 2001 From: Melanie Plageman Date: Fri, 29 Mar 2024 19:43:09 -0400 Subject: [PATCH v11 3/7] Introduce PRUNE_DO_* actions We will eventually take additional actions in

Re: Combine Prune and Freeze records emitted by vacuum

2024-04-01 Thread Melanie Plageman
On Mon, Apr 1, 2024 at 1:37 PM Heikki Linnakangas wrote: > > Committed the first of the remaining patches with those changes. And > also this, which is worth calling out: > > > if (prstate.htsv[offnum] == HEAPTUPLE_DEAD) > > { > > ItemId

Re: Combine Prune and Freeze records emitted by vacuum

2024-04-01 Thread Heikki Linnakangas
On 01/04/2024 19:08, Melanie Plageman wrote: On Mon, Apr 01, 2024 at 05:17:51PM +0300, Heikki Linnakangas wrote: diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c @@ -256,15 +270,16 @@ heap_page_prune(Relation relation, Buffer buffer, tup.t_tableOid

Re: Combine Prune and Freeze records emitted by vacuum

2024-04-01 Thread Melanie Plageman
On Mon, Apr 01, 2024 at 05:17:51PM +0300, Heikki Linnakangas wrote: > On 30/03/2024 07:57, Melanie Plageman wrote: > > > The final state of the code could definitely use more cleanup. I've been > > staring at it for awhile, so I could use some thoughts/ideas about what > > part to focus on

Re: Combine Prune and Freeze records emitted by vacuum

2024-04-01 Thread Melanie Plageman
On Mon, Apr 01, 2024 at 05:17:51PM +0300, Heikki Linnakangas wrote: > On 30/03/2024 07:57, Melanie Plageman wrote: > > On Fri, Mar 29, 2024 at 12:32:21PM -0400, Melanie Plageman wrote: > > > On Fri, Mar 29, 2024 at 12:00 PM Heikki Linnakangas > > > wrote: > > > > Here's another idea: In the

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-30 Thread Melanie Plageman
On Sat, Mar 30, 2024 at 8:00 AM Robert Haas wrote: > > On Sat, Mar 30, 2024 at 1:57 AM Melanie Plageman > wrote: > > I think that we are actually successfully removing more RECENTLY_DEAD > > HOT tuples than in master with heap_page_prune()'s new approach, and I > > think it is correct; but let

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-30 Thread Robert Haas
On Sat, Mar 30, 2024 at 1:57 AM Melanie Plageman wrote: > I think that we are actually successfully removing more RECENTLY_DEAD > HOT tuples than in master with heap_page_prune()'s new approach, and I > think it is correct; but let me know if I am missing something. /me blinks. Isn't zero the

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-29 Thread Melanie Plageman
On Fri, Mar 29, 2024 at 12:00 PM Heikki Linnakangas wrote: > > On 29/03/2024 07:04, Melanie Plageman wrote: > > On Thu, Mar 28, 2024 at 11:07:10AM -0400, Melanie Plageman wrote: > >> These comments could use another pass. I had added some extra > >> (probably redundant) content when I thought I

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-29 Thread Heikki Linnakangas
On 29/03/2024 07:04, Melanie Plageman wrote: On Thu, Mar 28, 2024 at 11:07:10AM -0400, Melanie Plageman wrote: These comments could use another pass. I had added some extra (probably redundant) content when I thought I was refactoring it a certain way and then changed my mind. Attached is a

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-28 Thread Melanie Plageman
On Thu, Mar 28, 2024 at 4:49 AM Heikki Linnakangas wrote: > > On 28/03/2024 03:53, Melanie Plageman wrote: > > On Thu, Mar 28, 2024 at 01:04:04AM +0200, Heikki Linnakangas wrote: > >> One change with this is that live_tuples and many of the other fields are > >> now again updated, even if the

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-28 Thread Heikki Linnakangas
On 28/03/2024 03:53, Melanie Plageman wrote: On Thu, Mar 28, 2024 at 01:04:04AM +0200, Heikki Linnakangas wrote: One change with this is that live_tuples and many of the other fields are now again updated, even if the caller doesn't need them. It was hard to skip them in a way that would save

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-27 Thread Melanie Plageman
On Thu, Mar 28, 2024 at 01:04:04AM +0200, Heikki Linnakangas wrote: > On 27/03/2024 20:26, Melanie Plageman wrote: > > On Wed, Mar 27, 2024 at 12:18 PM Heikki Linnakangas wrote: > > > > > > On 27/03/2024 17:18, Melanie Plageman wrote: > > > > I need some way to modify the control flow or

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-27 Thread Melanie Plageman
On Wed, Mar 27, 2024 at 2:26 PM Melanie Plageman wrote: > > On Wed, Mar 27, 2024 at 12:18 PM Heikki Linnakangas wrote: > > > > On 27/03/2024 17:18, Melanie Plageman wrote: > > > I need some way to modify the control flow or accounting such that I > > > know which HEAPTUPLE_RECENTLY_DEAD tuples

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-27 Thread Melanie Plageman
On Wed, Mar 27, 2024 at 12:18 PM Heikki Linnakangas wrote: > > On 27/03/2024 17:18, Melanie Plageman wrote: > > I need some way to modify the control flow or accounting such that I > > know which HEAPTUPLE_RECENTLY_DEAD tuples will not be marked LP_DEAD. > > And a way to consider freezing and do

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-27 Thread Peter Geoghegan
On Tue, Mar 19, 2024 at 9:36 PM Melanie Plageman wrote: > * "Freeze" NewRelfrozenXid/NewRelminMxid trackers. > * > * Trackers used when heap_freeze_execute_prepared freezes, or when > there > * are zero freeze plans for a page. It is always valid for >

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-27 Thread Heikki Linnakangas
On 27/03/2024 17:18, Melanie Plageman wrote: I need some way to modify the control flow or accounting such that I know which HEAPTUPLE_RECENTLY_DEAD tuples will not be marked LP_DEAD. And a way to consider freezing and do live tuple accounting for these and HEAPTUPLE_LIVE tuples exactly once.

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-27 Thread Melanie Plageman
On Tue, Mar 26, 2024 at 5:46 PM Melanie Plageman wrote: > > On Mon, Mar 25, 2024 at 09:33:38PM +0200, Heikki Linnakangas wrote: > > On 24/03/2024 18:32, Melanie Plageman wrote: > > > On Thu, Mar 21, 2024 at 9:28 AM Heikki Linnakangas > > > wrote: > > > > > > > > In heap_page_prune_and_freeze(),

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-25 Thread Melanie Plageman
Thanks for committing the new WAL format! On Mon, Mar 25, 2024 at 3:33 PM Heikki Linnakangas wrote: > > On 24/03/2024 18:32, Melanie Plageman wrote: > > On Thu, Mar 21, 2024 at 9:28 AM Heikki Linnakangas wrote: > >> > >> In heap_page_prune_and_freeze(), we now do some extra work on each live >

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-25 Thread Heikki Linnakangas
On 24/03/2024 18:32, Melanie Plageman wrote: On Thu, Mar 21, 2024 at 9:28 AM Heikki Linnakangas wrote: In heap_page_prune_and_freeze(), we now do some extra work on each live tuple, to set the all_visible_except_removable correctly. And also to update live_tuples, recently_dead_tuples and

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-25 Thread Heikki Linnakangas
On 24/03/2024 21:55, Melanie Plageman wrote: On Sat, Mar 23, 2024 at 01:09:30AM +0200, Heikki Linnakangas wrote: On 20/03/2024 21:17, Melanie Plageman wrote: There is another patch in the commitfest that touches this area: "Recording whether Heap2/PRUNE records are from VACUUM or from

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-24 Thread Melanie Plageman
On Sat, Mar 23, 2024 at 01:09:30AM +0200, Heikki Linnakangas wrote: > On 20/03/2024 21:17, Melanie Plageman wrote: > > Attached patch changes-for-0001.patch has a bunch of updated comments -- > > especially for heapam_xlog.h (including my promised diagram). And a few > > suggestions (mostly

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-24 Thread Melanie Plageman
On Thu, Mar 21, 2024 at 9:28 AM Heikki Linnakangas wrote: > > In heap_page_prune_and_freeze(), we now do some extra work on each live > tuple, to set the all_visible_except_removable correctly. And also to > update live_tuples, recently_dead_tuples and hastup. When we're not > freezing, that's a

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-22 Thread Heikki Linnakangas
On 20/03/2024 21:17, Melanie Plageman wrote: Attached patch changes-for-0001.patch has a bunch of updated comments -- especially for heapam_xlog.h (including my promised diagram). And a few suggestions (mostly changes that I should have made before). New version of these WAL format changes

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-21 Thread Heikki Linnakangas
On 20/03/2024 23:03, Melanie Plageman wrote: On Wed, Mar 20, 2024 at 03:15:49PM +0200, Heikki Linnakangas wrote: diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index ee0eca8ae02..b2015f5a1ac 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-20 Thread Melanie Plageman
On Wed, Mar 20, 2024 at 03:15:49PM +0200, Heikki Linnakangas wrote: > > 0009-: The rest of the v4 patches, rebased over the WAL format changes. I > also added a few small commits for little cleanups that caught my eye, let > me know if you disagree with those. This review is just of the patches

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-20 Thread Peter Geoghegan
On Wed, Mar 20, 2024 at 4:06 PM Melanie Plageman wrote: > > What about the issue of cleanup locks, which aren't needed and aren't > > taken with the current heapam VACUUM record type? Will you preserve > > that aspect of the existing design? > > Yep, we have a flag to indicate whether or not a

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-20 Thread Melanie Plageman
On Wed, Mar 20, 2024 at 4:04 PM Peter Geoghegan wrote: > > On Wed, Mar 20, 2024 at 9:15 AM Heikki Linnakangas wrote: > > > I made it its own sub-record (xlhp_conflict_horizon) less to help with > > > alignment (though we can use all the help we can get there) and more to > > > keep it from

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-20 Thread Peter Geoghegan
On Wed, Mar 20, 2024 at 9:15 AM Heikki Linnakangas wrote: > > I made it its own sub-record (xlhp_conflict_horizon) less to help with > > alignment (though we can use all the help we can get there) and more to > > keep it from getting lost. When you look at heapam_xlog.h, you can see > > what a

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-20 Thread Melanie Plageman
On Wed, Mar 20, 2024 at 03:15:49PM +0200, Heikki Linnakangas wrote: > On 20/03/2024 03:36, Melanie Plageman wrote: > > On Mon, Mar 18, 2024 at 01:15:21AM +0200, Heikki Linnakangas wrote: > > > On 15/03/2024 02:56, Melanie Plageman wrote: > > > > Okay, so I was going to start using xl_heap_prune

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-17 Thread Heikki Linnakangas
On 15/03/2024 02:56, Melanie Plageman wrote: Okay, so I was going to start using xl_heap_prune for vacuum here too, but I realized it would be bigger because of the snapshotConflictHorizon. Do you think there is a non-terrible way to make the snapshotConflictHorizon optional? Like with a flag?

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-11 Thread Heikki Linnakangas
On 09/03/2024 22:41, Melanie Plageman wrote: On Wed, Mar 6, 2024 at 7:59 AM Heikki Linnakangas wrote: Does GlobalVisTestIsRemovableXid() handle FrozenTransactionId correctly? Okay, so I thought a lot about this, and I don't understand how GlobalVisTestIsRemovableXid() would not handle

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-09 Thread Melanie Plageman
Thanks so much for the review! On Wed, Mar 6, 2024 at 7:59 AM Heikki Linnakangas wrote: > > On 25/01/2024 00:49, Melanie Plageman wrote: > > > The attached patch set is broken up into many separate commits for > > ease of review. Each patch does a single thing which can be explained > > plainly

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-06 Thread Heikki Linnakangas
On 25/01/2024 00:49, Melanie Plageman wrote: Generates 30% fewer WAL records and 12% fewer WAL bytes -- which, depending on what else is happening on the system, can lead to vacuum spending substantially less time on WAL writing and syncing (often 15% less time on WAL writes and 10% less time on