Re: 回复:how to create index concurrently on partitioned table

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: 李杰(慎追) <adger.lj@alibaba-inc.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>, 曾文旌(义从) <wenjing.zwj@alibaba-inc.com>, Alvaro Herrera <alvherre@2ndquadrant.com>
Date: 2020-06-15T12:37:42Z
Lists: pgsql-hackers
On Mon, Jun 15, 2020 at 08:15:05PM +0800, 李杰(慎追) wrote:
> As shown above, an error occurred while creating an index in the second partition. 
> It can be clearly seen that the index of the partitioned table is invalid 
> and the index of the first partition is normal, the second partition is invalid, 
> and the Third Partition index does not exist at all.

That's a problem.  I really think that we should make the steps of the
concurrent operation consistent across all relations, meaning that all
the indexes should be created as invalid for all the parts of the
partition tree, including partitioned tables as well as their
partitions, in the same transaction.  Then a second new transaction
gets used for the index build, followed by a third one for the
validation that switches the indexes to become valid.
--
Michael

Commits

  1. Allow CLUSTER on partitioned tables

  2. Add support for partitioned tables and indexes in REINDEX

  3. Local partitioned indexes