Re: Allowing REINDEX to have an optional name

From: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allowing REINDEX to have an optional name
Date: 2022-05-11 14:33:52
Message-ID: CANbhV-HzU3f4NkfS9O1+UuJA_HtKhEeNeu8zd54wmLv3G-dS0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 11 May 2022 at 05:24, Ashutosh Bapat
<ashutosh(dot)bapat(at)enterprisedb(dot)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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2022-05-11 14:41:52 Re: First draft of the PG 15 release notes
Previous Message Bruce Momjian 2022-05-11 14:32:21 Re: First draft of the PG 15 release notes