Re: Partitioning syntax

From: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Partitioning syntax
Date: 2010-01-18 08:55:52
Message-ID: 20100118175551.9B43.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> A couple of preliminary comments on this:

Thanks.
The attached is rebased on HEAD, with additional documentation.

> 1. If we're thinking that this syntax should eventually result in
> inserts (and updates?) being redirected to the appropriate partition,
> then I think we should have that in the initial version. I don't
> think we really want to add the syntax with a plan to change its
> behavior incompatibly down the road.

It's true that we need an alternative method for insert triggers,
but I'd like to submit it as another patch in the next development cycle.
I think the syntax proposed here is carefully chosen so that we will
not frequently modify modify them.

> 2. The documentation does not explain what partitioning by list or by
> range means, or what the difference between the two is. I think some
> kind of general introduction to the subject is essential.

Oops, I've forgotten to update ddl.sgml for the new syntax. I rewrote
ddl-partition section to use the new syntax, with some other changes:

1. Use PARTITION BY RANGE and CREATE PARTITION for the example.

2. Recommend to define indexes for the parent table, and copy the
definition to each partition with CREATE PARTITION or
CREATE TABLE (LIKE INCLUDING ALL).

3. Use an EXECUTE USING rather than a huge IF-THEN-ELSE block
in the insert trigger. The new recommended code is:
EXECUTE 'INSERT INTO ' || to_relname(NEW) || ' VALUES ($1.*)' USING NEW;
We don't need to update the trigger function if partitions are
added or removed with this form.

We could apply changes in 2 and 3 even without the partitioning patch.
I think we can define trigger functions with EXECUTE USING easliy
compared to before. I'm willing to split the doc patch if needed.

> 3. This patch is large enough (+1951/-63) that we have to consider
> whether it makes sense to merge it at this point in the release cycle.
> It doesn't change much existing code, which is a point in its favor,
> but it's still a big patch. I guess we can wait until we're a little
> further along to make that decision.

It depends on reviewers :) But I think the partitioning patch never
go to waste -- I'll continue to improve it if any feedbacks.

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center

Attachment Content-Type Size
partitioning-syntax_20100118.patch application/octet-stream 157.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2010-01-18 08:56:56 Re: New XLOG record indicating WAL-skipping
Previous Message Simon Riggs 2010-01-18 08:45:54 Re: Hot Standby and handling max_standby_delay