Thread

  1. Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements

    Hannu Krosing <hannuk@google.com> — 2025-11-28T18:05:12Z

    On Fri, Nov 28, 2025 at 6:58 PM Hannu Krosing <hannuk@google.com> wrote:
    >
    > On Fri, Nov 28, 2025 at 5:58 PM Matthias van de Meent
    > <boekewurm+postgres@gmail.com> wrote:
    > >
    > ...
    > > I'm a bit worried, though, that LR may lose updates due to commit
    > > order differences between WAL and PGPROC. I don't know how that's
    > > handled in logical decoding, and can't find much literature about it
    > > in the repo either.
    >
    > Now the reference to logical decoding made me think that maybe to real
    > fix for CIC would be to leverage logical decoding for the 2nd pass of
    > CIC and not worry about in-page visibilities at all.
    
    And if we are concerned about having possibly to scan more WAL than we
    would have had to scan the table, we can start a
    tuple-to-index-collector immediately after starting the CIC.
    
    For extra efficiency gains the collector itself should have two phases
    
    1. While the first pass of CIC is collecting the visible tuple for
    index the logical decoding collector also collects any new tuples
    added after the CIC start.
    2. When the first pass collection finishes, it also gets the indexes
    collected so far by the logical decoding collectoir and adds them to
    the first set before the sorting and creating the index.
    
    3. once the initial index is created, the CIC just gets whatever else
    was collected after 2. and adds these to the index
    
    ---
    Hannu
    
    
    
    
    >
    > ---
    > Hannu