Re: 回复:how to create index concurrently on partitioned table
Justin Pryzby <pryzby@telsasoft.com>
From: Justin Pryzby <pryzby@telsasoft.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: 李杰(慎追) <adger.lj@alibaba-inc.com>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>, 曾文旌(义从) <wenjing.zwj@alibaba-inc.com>, Alvaro Herrera <alvherre@2ndquadrant.com>
Date: 2020-09-26T19:56:55Z
Lists: pgsql-hackers
Attachments
On Thu, Sep 24, 2020 at 05:11:03PM +0900, Michael Paquier wrote: > start. So, the goal of the patch, as I would define it, is to give a > way to CLUSTER to work on a partitioned table using a given > partitioned index. Hence, we would perform CLUSTER automatically from > the top-most parent for any partitions that have an index on the same > partition tree as the partitioned index defined in USING, switching > indisclustered automatically depending on the index used. I think that's right, except there's no need to look for a compatible partitioned index: we just use the child index. Also, if a partitioned index is clustered, when we clear indisclustered for other indexes, should we also propogate that to their parent indexes, if any ? > From what I can see, attempting to use a CLUSTER on a top-most > partitioned table fails to work on child tables, Oops - it looks like this patch never worked right, due to the RECHECK on indisclustered. I think maybe I returned to the CIC patch and never finishing with cluster. > It would be good also to check if > we have a partition index tree that maps partially with a partition > table tree (aka no all table partitions have a partition index), where > these don't get clustered because there is no index to work on. This should not happen, since a incomplete partitioned index is "invalid". > Isn't NoLock unsafe here, even knowing that an exclusive lock is taken on > the parent? It seems to me that at least schema changes should be > prevented with a ShareLock in the first transaction building the list > of elements to cluster. Thanks for noticing. I chose ShareUpdateExclusiveLock since it's set-exclusive. -- Justin
Commits
-
Allow CLUSTER on partitioned tables
- cfdd03f45e6a 15.0 landed
-
Add support for partitioned tables and indexes in REINDEX
- a6642b3ae060 14.0 landed
-
Local partitioned indexes
- 8b08f7d4820f 11.0 cited