Re: REPACK and naming - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: REPACK and naming
Date
Msg-id 202509182239.7u77v65vw7di@alvherre.pgsql
Whole thread Raw
In response to Re: REPACK and naming  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
On 2025-Sep-18, Bruce Momjian wrote:

> Uh, if VACUUM FULL and CLUSTER functionality are going to eventually
> point to REPACK, REPACK is the wrong name.

I obviously don't agree.

> While I can see REPACK having a similar function to VACUUM FULL, the
> ordering idea of CLUSTER just doesn't fit into "repack".

In my opinion, it fits perfectly well.

> I am repacking in a specific order?  What if I only want the order
> changed without repacking?

Yes, you can ask the repacking process to write the tuples in a specific
order -- that's a perfectly reasonable thing to ask for, and nobody
would be confused about what that would do.  You want the order changed
but not repacking?  I don't see why would anybody think that that's
something to ask for.

> When did I pack that I have to re-pack now?

David Johnston said it here best:
https://postgr.es/m/CAKFQuwYbZ2c7viape0B+TAoa_t8WteNfu+RF8+3i=D1ZQZQFAg@mail.gmail.com
you packed when you started adding tuples to the table.  Repack takes
what you have "packed" and puts it in order again.

> Of the names I have seen, I think REBUILD makes the most sense.  I
> built the table --- I want it rebuilt now, and perhaps with a specific
> ordering.

I frankly don't like REBUILD one bit.  Nobody BUILDs tables either.
One thing we do build is indexes, but a table is not an index.

(I was not very impressed with David Rowley's idea that we could have
REBUILD INDEX as a substitute for REINDEX, if we were inventing these in
a green field.  Two reasons for that: one is that REINDEX is not only a
Postgres-established term, but also an industry-wide established term.
The other is that REINDEX also supports REINDEX TABLE, which doesn't
literally mean to reindex the table but instead of reindex all the
_indexes_ of the table; if we wanted to use REBUILD for that we would
have to do something like "REBUILD INDEXES OF TABLE xyz" which, as you
see, gets unwieldy.  And for what?)

I highly doubt that anybody is going to be confused in the slightest
about what the REPACK command does, or that they would start to think
about when did they PACK anything before.  That sort of argument seems
entirely artificial, and that is not how people think.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"The ability of users to misuse tools is, of course, legendary" (David Steele)
https://postgr.es/m/11b38a96-6ded-4668-b772-40f992132797@pgmasters.net



pgsql-hackers by date:

Previous
From: Matheus Alcantara
Date:
Subject: Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue
Next
From: Álvaro Herrera
Date:
Subject: Re: REPACK and naming