pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Reindex toast before its main relation in reindex_relation()
Date: Fri, 26 Jan 2024 08:40:34 +0000
Message-ID: <E1rTHlK-003B86-Bw@gemulon.postgresql.org> (raw)

Reindex toast before its main relation in reindex_relation()

This commit changes the order of reindex on a relation so as a toast
relation is processed before its main relation.

The original order, where a rebuild was first done for the indexes on
the main table, could be a problem in the event of a corruption of a
toast index, because, as scans of a toast index may be required to
rebuild the indexes on the main relation, this could lead to failures
with REINDEX TABLE without being able to fix anything.

Rebuilding corrupted toast indexes before this change was possible but
troublesome, as it was necessary to issue a REINDEX on the toast
relation first, followed by a REINDEX on the main relation.  Changing
the order of these operations should make things easier when rebuilding
corrupted indexes, as toast indexes would be rebuilt before they are
used for the indexes on the main relation.

Per request from Richard Vesely.

Author: Gurjeet Singh
Reviewed-by: Nathan Bossart, Michael Paquier
Discussion: https://postgr.es/m/18016-2bd9b549b1fe49b3@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f2bf8fb04886e3ea82e7f7f86696ac78e06b7e60

Modified Files
--------------
src/backend/catalog/index.c | 52 +++++++++++++++++++++++++++------------------
1 file changed, 31 insertions(+), 21 deletions(-)



Message-ID: <E1rTHlK-003B86-Bw@gemulon.postgresql.org>
Permalink:  ../E1rTHlK-003B86-Bw@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rTHlK-003B86-Bw@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Reindex toast before its main relation in reindex_relation()
  In-Reply-To: <E1rTHlK-003B86-Bw@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox