Re: 回复:回复:回复:how to create index concurrently on partitioned table - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: 回复:回复:回复:how to create index concurrently on partitioned table
Date
Msg-id 20200618024114.GF118592@paquier.xyz
Whole thread Raw
In response to 回复:回复:回复:how to create index concurrently on partitioned table  ("李杰(慎追)" <adger.lj@alibaba-inc.com>)
Responses 回复:回复:回复:回复:how to create index concurrently on partitioned table
Re: 回复:how to create index concurrently on partitioned table
List pgsql-hackers
On Wed, Jun 17, 2020 at 10:22:28PM +0800, 李杰(慎追) wrote:
> However, I found a problem. If there are many partitions,
> we may need to handle too many missing index entries when
> validate_index().  Especially for the first partition, the time may
> have been long and many entries are missing.  In this case, why
> don't we put the second and third phase together into a transaction
> for each partition?

Not sure I am following.  In the case of REINDEX, it seems to me that
the calls to validate_index() and index_concurrently_build() can
happen in a separate transaction for each index, as long as all the
calls to index_concurrently_swap() are grouped together in the same
transaction to make sure that index partition trees are switched
consistently when all entries are swapped from an invalid state to a
valid state, because the swapping phase is also when we attach a fresh
index to a partition tree.  See also index_concurrently_create_copy()
where we don't set parentIndexRelid for the lower call to
index_create().  It would be good of course to check that when
swapping we have the code to handle that for a lot of indexes at
once.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Resetting spilled txn statistics in pg_stat_replication
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Review for GetWALAvailability()