Re: Allowing REINDEX to have an optional name
Bernd Helmle <mailings@oopsware.de>
From: Bernd Helmle <mailings@oopsware.de>
To: Simon Riggs <simon.riggs@enterprisedb.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2022-05-10T12:29:31Z
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
Commits
-
Tweak a bit the new TAP tests of REINDEX DATABASE/SYSTEM
- 2b99ce10c2bc 16.0 landed
-
Rework logic and simplify syntax of REINDEX DATABASE/SYSTEM
- 2cbc3c17a5c1 16.0 landed
-
Add more tests for REINDEX DATABASE/SYSTEM with relfilenode changes
- 5fb5b6c4c176 16.0 landed