Re: REPACK and naming

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>, Robert Haas <robertmhaas(at)gmail(dot)com>, 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-19 12:42:58
Message-ID: 202509191239.x2bxoygrluit@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Sep-19, David Rowley wrote:

> On Fri, 19 Sept 2025 at 21:36, Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> >
> > So, there's already an implementation of an index-organized table in
> > OrioleDB, as I understand, so maybe we can ask Alexander K. about this.
> > I suspect it's fine to say that if you have a table for which it makes
> > no sense to use REPACK USING INDEX, then we just throw an error in that
> > case (but I suppose plain REPACK continues to work, and it just
> > recreates/compacts the primary index and rebuilds all secondary indexes,
> > just like VACUUM FULL would presumably do.)
>
> What I was wondering was if REPACK tab ORDER BY col; would be the way
> to change the IOT's order.

Sure -- the IOT is the "primary index", so what you are saying is, I
think, the same as what I was saying.

> > Well, I hope you mean that clustering by an index would stop being the
> > _only_ way, not that it would completely disappear as an option.
>
> I mean support clustered orders that don't exist in any defined index.

Yes: I mean, I imagine that an implementation of
REPACK tab ORDER BY col2
(on normal heap tables) when there's no index on col2 would just use a
seqscan-and-sort to put the tably in that physical order, and
potentially store somewhere that "col2" is the order that was used.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Selbst das größte Genie würde nicht weit kommen, wenn es
alles seinem eigenen Innern verdanken wollte." (Johann Wolfgang von Goethe)
Ni aún el genio más grande llegaría muy lejos si
quisiera sacarlo todo de su propio interior.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2025-09-19 12:49:02 Re: REPACK and naming
Previous Message torikoshia 2025-09-19 12:42:16 Re: RFC: Logging plan of the running query