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-10-05T20:08:32Z
Lists: pgsql-hackers
On Mon, Oct 05, 2020 at 05:46:27PM +0900, Michael Paquier wrote: > On Sat, Sep 26, 2020 at 02:56:55PM -0500, Justin Pryzby wrote: > > 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 ? > > I am not sure what you mean here. Each partition's cluster runs in > its own individual transaction based on the patch you sent. Are you > suggesting to update indisclustered for the partitioned index of a > partitioned table and all its parent partitioned in the same > transaction, aka a transaction working on the partitioned table? No, I mean that if a partition is no longer clustered on some index, then its parent isn't clustered on that indexes parent, either. It means that we might do N catalog updates for a partition heirarchy that's N levels deep. Normally, N=2, and we'd clear indisclustered for the index as well as its parent. This is not essential, though. > >> 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". > > Indeed, I did not know this property. I think that's something we can apply for CIC/DIC, too. It's not essential to avoid leaving an "invalid" or partial index if interrupted. It's only essential that a partial, partitioned index is not "valid". For DROP IND CONCURRENTLY, I wrote: On Mon, Sep 14, 2020 at 09:31:03AM -0500, Justin Pryzby wrote: > 2. Maybe the easiest way is to mark all indexes invalid and then drop all > partitions (concurrently) and then the partitioned parent. If interrupted, > this would leave a parent index marked "invalid", and some child tables with no > indexes. I think this may be "ok". The same thing is possible if a concurrent > build is interrupted, right ? -- 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