Re: how to create index concurrently on partitioned table

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: 李杰(慎追) <adger(dot)lj(at)alibaba-inc(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, 曾文旌(义从) <wenjing(dot)zwj(at)alibaba-inc(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Subject: Re: how to create index concurrently on partitioned table
Date: 2020-06-11 15:35:02
Message-ID: 20200611153502.GT14879@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jun 07, 2020 at 01:04:48PM -0500, Justin Pryzby wrote:
> On Sat, Jun 06, 2020 at 09:23:32AM -0500, Justin Pryzby wrote:
> > On Wed, Jun 03, 2020 at 08:22:29PM +0800, 李杰(慎追) wrote:
> > > Partitioning is necessary for very large tables. However, I found that
> > > postgresql does not support create index concurrently on partitioned
> > > tables. The document show that we need to create an index on each
> > > partition individually and then finally create the partitioned index
> > > non-concurrently. This is undoubtedly a complex operation for DBA,
> > > especially when there are many partitions.

I added functionality for C-I-C, REINDEX-CONCURRENTLY, and CLUSTER of
partitioned tables. We already recursively handle VACUUM and ANALYZE since
v10.

And added here:
https://commitfest.postgresql.org/28/2584/

Adger, if you're familiar with compilation and patching, do you want to try the
patch ?

Note, you could do this now using psql like:
SELECT format('CREATE INDEX CONCURRENTLY ... ON %s(col)', a::regclass) FROM pg_partition_ancestors() AS a;
\gexec

--
Justin

Attachment Content-Type Size
v2-0001-Allow-CREATE-INDEX-CONCURRENTLY-on-partitioned-ta.patch text/x-diff 7.6 KB
v2-0002-Implement-CLUSTER-of-partitioned-table.patch text/x-diff 8.9 KB
v2-0003-Implement-REINDEX-of-partitioned-tables-indexes.patch text/x-diff 12.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2020-06-11 15:37:53 pg_dump, gzwrite, and errno
Previous Message Magnus Hagander 2020-06-11 15:27:57 Re: Recording test runtimes with the buildfarm