Re: Allowing REINDEX to have an optional name

From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allowing REINDEX to have an optional name
Date: 2022-05-10 12:29:31
Message-ID: 9832691be1eaad11583734603dc83f8d4f77bc6a.camel@oopsware.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Am Dienstag, dem 10.05.2022 um 10:13 +0100 schrieb Simon Riggs:
> A minor issue, and patch.
>
> REINDEX DATABASE currently requires you to write REINDEX DATABASE
> dbname, which makes this a little less usable than we might like.
>
> REINDEX on the catalog can cause deadlocks, which also makes REINDEX
> DATABASE not much use in practice, and is the reason there is no test
> for REINDEX DATABASE. Another reason why it is a little less usable
> than we might like.
>
> Seems we should do something about these historic issues in the name
> of product usability.
>

Wow, i just recently had a look into that code and talked with my
colleagues on how the current behavior annoyed me last week....and
there you are! This community rocks ;)

> Attached patch allows new syntax for REINDEX DATABASE, without
> needing
> to specify dbname. That version of the command skips catalog tables,
> as a way of avoiding the known deadlocks. Patch also adds a test.
>

+ /* Unqualified REINDEX DATABASE will skip catalog
tables */
+ if (objectKind == REINDEX_OBJECT_DATABASE &&
+ objectName == NULL &&
+ IsSystemClass(relid, classtuple))
+ continue;

Hmm, shouldn't we just print a NOTICE or something like this in
addition to this check to tell the user that we are *not* really
reindexing all things (and probably give him a hint to use REINDEX
SYSTEM to cover them)?

Thanks,
Bernd

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-05-10 12:39:37 Re: Support logical replication of DDLs
Previous Message Andrey Borodin 2022-05-10 12:25:01 Re: An attempt to avoid locally-committed-but-not-replicated-to-standby-transactions in synchronous replication