Thread

  1. Re: REPACK and naming

    Alvaro Herrera <alvherre@alvh.no-ip.org> — 2025-09-18T22:55:51Z

    On 2025-Sep-17, David G. Johnston wrote:
    
    > On Wednesday, September 17, 2025, David Rowley <dgrowleyml@gmail.com> wrote:
    > 
    > > On Thu, 18 Sept 2025 at 01:09, Robert Haas <robertmhaas@gmail.com> wrote:
    > > > RETABLE just isn't a word. The code sometimes calls this a REWRITE of
    > > > a table, which would be reasonable.
    > >
    > > +1. I was reading this yesterday wondering why "REWRITE" didn't get a
    > > mention.
    > 
    > Agreed.
    
    That's true, but ALTER TABLE also rewrites the table in some cases, so
    the words used inside the source code shouldn't really be taken as
    guidance for what to call the user-visible features.  Consider for
    instance that the code that implements this whole thing lives in
    cluster.c, and we're not going to change that file name, at least not
    yet.
    
    I'm not particularly excited about REWRITE, as it sounds a little bit
    too generic, plus we already have the "query rewriter" which rewrites,
    and I think it would be good that we stop overloading terms for
    completely different things.
    
    > > The problem I have with REPACK is that "re" indicates that something
    > > is being re-done that's been done before. If you're calling REPACK
    > > for the first time on a table, that's not true.
    >
    > As soon as you’ve written the first tuple you’ve begun “packing” the
    > table - repack then is simply unpacking it and putting back the stuff
    > you want to keep in possibly a structured way.
    
    Yeah, that's how I see it.
    
    > > David J's "REBUILD" also seems ok.  In a green field, you could then
    > > have "REBUILD TABLE ..." and "REBUILD INDEX ..."
    
    Yeah, but then we have REINDEX TABLE or REINDEX SYSTEM, so if you wanted
    to do all of REINDEX with REPACK or REBUILD, you would need more syntax
    than just that.
    
    It had never occurred to me that we could use this new command (whatever
    its name) to rebuild indexes without rebuilding the table.  I'm not
    proposing that.  Do we actually want to entertain such a proposal?
    
    > Rebuild has some prior art apparently, which makes it appealing.
    
    Can you cite that?  I've seen "ALTER TABLE/INDEX REBUILD", but not
    REBUILD as a standalone command.
    
    -- 
    Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/