public inbox for [email protected]  
help / color / mirror / Atom feed
From: David Klika <[email protected]>
To: [email protected]
To: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Subject: Re: Adding REPACK [concurrently]
Date: Thu, 4 Dec 2025 16:17:51 +0100
Message-ID: <[email protected]> (raw)

Hello

Great to hear about this feature.

You speak about table rewrite (suppose a whole-table rewrite). I would 
like to share idea of an alternative approach that also takes into 
account amount of WAL generated during the operation. Applicable to 
non-clustered case only.

Let's consider a large table where 80% blocks are fine (filled enough by 
live tuples). The table could be scanned from the beginning (left side) 
to identify "not enough filled" blocks and also from the end (right 
side) to process live tuples by moving them to the blocks identified 
by the left side scan. The work is over when both scan reaches the same 
position.

Example:

_ stands for filled enough blocks

D stands for blocks with (many) dead tuples

123456789
___DD____

Left scan identifies page #4 and tuples from the right scan (page #9) 
are moved here. The same with tuples from #8 to #5. Two pages from the 
data file are trimmed and (only) pages #4 and #5 are written in WAL, 
others are untouched.

Regards
David






view thread (18+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Adding REPACK [concurrently]
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox