Re: Allowing REINDEX to have an optional name - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Allowing REINDEX to have an optional name
Date
Msg-id CANbhV-HzU3f4NkfS9O1+UuJA_HtKhEeNeu8zd54wmLv3G-dS0w@mail.gmail.com
Whole thread Raw
In response to Re: Allowing REINDEX to have an optional name  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Responses Re: Allowing REINDEX to have an optional name  (Cary Huang <cary.huang@highgo.ca>)
Re: Allowing REINDEX to have an optional name  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-hackers
On Wed, 11 May 2022 at 05:24, Ashutosh Bapat
<ashutosh.bapat@enterprisedb.com> wrote:

>> It is designed like this because it is dangerous to REINDEX the system
>> catalogs because of potential deadlocks, so we want a way to avoid
>> that problem.
>
> It's more clear if we add SKIP SYSTEM CATALOGS or some such explicit syntax.

Clarity is not the issue. I am opposed to a default mode that does
something bad and non-useful.

If you want to reindex the system catalogs then we already have REINDEX SYSTEM.
So REINDEX (SKIP_SYSTEM_CATALOGS OFF) DATABASE would do the same thing.
But you don't want to run either of them because of deadlocking.

The only action that makes sense is to reindex the database, skipping
the catalog tables.

So I'm proposing a command that has useful default behavior.
i.e. REINDEX DATABASE is the same as REINDEX (SKIP_SYSTEM_CATALOGS ON) DATABASE.

If you make REINDEX DATABASE the same as REINDEX (SKIP_SYSTEM_CATALOGS
OFF) DATABASE then it is just dangerous and annoying, i.e. a POLA
violation.

The point of this was a usability improvement, not just new syntax.

--
Simon Riggs                http://www.EnterpriseDB.com/



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: First draft of the PG 15 release notes
Next
From: Bruce Momjian
Date:
Subject: Re: First draft of the PG 15 release notes