Re: CLUSTER on partitioned index
Zhihong Yu <zyu@yugabyte.com>
From: Zhihong Yu <zyu@yugabyte.com>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Michael Paquier <michael@paquier.xyz>, 李杰(慎追) <adger.lj@alibaba-inc.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>, 曾文旌(义从) <wenjing.zwj@alibaba-inc.com>, Alvaro Herrera <alvherre@2ndquadrant.com>
Date: 2021-02-06T17:21:08Z
Lists: pgsql-hackers
Hi, For v7-0002-Implement-CLUSTER-of-partitioned-table.patch: + * We have to build the list in a different memory context so it will + * survive the cross-transaction processing + */ + old_context = MemoryContextSwitchTo(cluster_context); cluster_context is not modified within the loop. Can the memory context switching code be moved outside the loop ? Cheers On Sat, Feb 6, 2021 at 6:46 AM Justin Pryzby <pryzby@telsasoft.com> wrote: > On Mon, Jan 18, 2021 at 12:34:59PM -0600, Justin Pryzby wrote: > > On Sat, Nov 28, 2020 at 08:03:02PM -0600, Justin Pryzby wrote: > > > On Sun, Nov 15, 2020 at 07:53:35PM -0600, Justin Pryzby wrote: > > > > On Wed, Nov 04, 2020 at 08:23:56PM -0600, Justin Pryzby wrote: > > > > > On Tue, Oct 27, 2020 at 07:33:12PM -0500, Justin Pryzby wrote: > > > > > > I'm attaching a counter-proposal to your catalog change, which > preserves > > > > > > indisclustered on children of clustered, partitioned indexes, > and invalidates > > > > > > indisclustered when attaching unclustered indexes. > > > > > > > > > > ..and now propagates CLUSTER ON to child indexes. > > > > > > > > > > I left this as separate patches to show what I mean and what's new > while we > > > > > discuss it. > > > > > > > > This fixes some omissions in the previous patch and error in its > test cases. > > > > > > > > CLUSTER ON recurses to children, since I think a clustered parent > index means > > > > that all its child indexes are clustered. "SET WITHOUT CLUSTER" > doesn't have > > > > to recurse to children, but I did it like that for consistency and > it avoids > > > > the need to special case InvalidOid. > > > > > > The previous patch failed pg_upgrade when restoring a clustered, > parent index, > > > since it's marked INVALID until indexes have been built on all child > tables, so > > > CLUSTER ON was rejected on invalid index. > > > > > > So I think CLUSTER ON needs to be a separate pg_dump object, to allow > attaching > > > the child index (thereby making the parent "valid") to happen before > SET > > > CLUSTER on the parent index. > > > > Rebased on b5913f612 and now a3dc92600. > > This resolves ORDER BY test failure with COLLATE "C". > > -- > Justin >
Commits
-
Add some isolation tests for CLUSTER
- 21a10368eb3f 15.0 landed
-
Have CLUSTER ignore partitions not owned by caller
- 3f19e176ae0f 15.0 landed
-
Remove "recheck" argument from check_index_is_clusterable()
- b940918dc888 15.0 landed
-
Allow CLUSTER on partitioned tables
- cfdd03f45e6a 15.0 landed
-
doc: Add backlinks to progress reporting documentation
- 8a8f4d8ede28 14.0 cited