From: | "Zeugswetter Andreas ADI SD" <ZeugswetterA(at)spardat(dot)at> |
---|---|
To: | "Markus Schiltknecht" <markus(at)bluegap(dot)ch>, "Gregory Stark" <stark(at)enterprisedb(dot)com> |
Cc: | "Simon Riggs" <simon(at)2ndquadrant(dot)com>, "NikhilS" <nikkhils(at)gmail(dot)com>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Auto Partitioning |
Date: | 2007-04-05 15:24:08 |
Message-ID: | E1539E0ED7043848906A8FF995BDA57901E7B8D2@m0143.s-mxs.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
> > That lets you enforce unique constraints as long as the partition
key
> > is part of the unique constraint.
>
> Is that already sufficient?
yes
> That would alter the ordering of
> the columns in the index, no? I mean:
It produces ordered blocks of append nodes for range queries that span
multiple partitions,
but one unique key can still only be in exactly one of the partitions.
e.g. If you range partition by b, only one partition is applicable
regardless
of the position of b in the index. This is sufficient for a working
unique constraint
with current pg versions.
> CREATE INDEX x ON test(a, b, c);
>
> isn't the same as
>
> CRETAE INDEX x ON test(c, b, a);
That is only a problem if you also want to avoid a sort (e.g. for an
order by),
it is not an issue for filtering rows.
And in some cases the sort could still be avoided with some range
proving logic,
if you can bring the append nodes of partitions into an order that
represents
the order by.
(an example would be a query "where c=5 and b between 0 and 20"
and two partitions one for 0 <= b < 10 and a second for 10 <= b)
> That's why I'd say, the first columns of an index would have
> to be equal to all of the columns used in the partitioning key.
No. It may change performance in some situations, but it is not needed
for unique constraints.
Andreas
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Goodaire | 2007-04-05 15:44:50 | Re: "Garbled" postgres logs |
Previous Message | Robert Treat | 2007-04-05 15:15:42 | Re: Auto Partitioning |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2007-04-05 15:49:23 | Re: Load distributed checkpoint V3 |
Previous Message | Robert Treat | 2007-04-05 15:15:42 | Re: Auto Partitioning |