Re: REPACK and naming

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: REPACK and naming
Date: 2025-09-18 22:55:51
Message-ID: 202509180819.vuxprone3lku@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Sep-17, David G. Johnston wrote:

> On Wednesday, September 17, 2025, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> > On Thu, 18 Sept 2025 at 01:09, Robert Haas <robertmhaas(at)gmail(dot)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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2025-09-18 23:03:59 Re: REPACK and naming
Previous Message Álvaro Herrera 2025-09-18 22:53:15 Re: REPACK and naming