Re: Proposal: Local indexes for partitioned table

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Maksim Milyutin <milyutinma(at)gmail(dot)com>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Subject: Re: Proposal: Local indexes for partitioned table
Date: 2017-10-27 17:27:30
Message-ID: 20171027172730.eh2domlkpn4ja62m@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera wrote:

> I'm now working on the ability to build unique indexes (and unique
> constraints) on top of this.

So I think there's not a lot of additional code required to support
unique indexes with the restrictions mentioned; proof-of-concept (with
several holes still) attached.

As before, this is not finished, as there a few things that are wrong
(such as generateClonedIndexStmt taking a RangeVar), and others that I
don't understand (such as why is rd_partkey NULL for partitioned
partitions when DefineIndex cascades to them and the columns are
checked).

I noticed that RelationBuildPartitionKey is generating a partition key
in a temp context, then creating a private context and copying the key
into that. That seems leftover from some previous iteration of some
other patch; I think it's pretty reasonable to create the new context
right from the start and allocate the key there directly instead. Then
there's no need for copy_partition_key at all.

Anyway, here is a preliminary submission before I close shop for the
week.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v2-0001-Tweak-index_create-index_constraint_create-APIs.patch text/plain 15.1 KB
v2-0002-Allow-indexes-on-partitioned-tables.patch text/plain 45.6 KB
v2-0003-export-generateClonedIndexStmt.patch text/plain 3.1 KB
v2-0004-Match-create-indexes-during-ATTACH-PARTITION.patch text/plain 8.3 KB
v2-0005-add-regression-test.patch text/plain 13.6 KB
v2-0006-Get-rid-of-copy_partition_key.patch text/plain 4.4 KB
v2-0007-allow-indexes-on-partitioned-tables-to-be-unique.patch text/plain 22.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-10-27 18:15:30 ALTER COLUMN TYPE vs. domain constraints
Previous Message Nico Williams 2017-10-27 17:17:13 Re: WIP: BRIN bloom indexes