From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Andy S <gatekeeper(dot)mail(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition |
Date: | 2020-11-14 01:14:21 |
Message-ID: | CAKFQuwYLtjoPh6Crrr1b2e92NSWJDLPE1W08C63u3JU9RBjooA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Fri, Nov 13, 2020 at 11:40 AM Andy S <gatekeeper(dot)mail(at)gmail(dot)com> wrote:
> That's then either a docs bug.
>
[...]
> Also:
> https://www.postgresql.org/docs/11/ddl-partitioning.html
> > The partitioning substitutes for leading columns of indexes, reducing
> index size and making it more likely that the heavily-used parts of the
> indexes fit in memory.
> That is exactly what this partitioning scheme is made for. Yet ridiculous
> constraint matching punishes for benefiting from partitioning.
>
Please don't top-post. The convention here is to inline or bottom-post.
I agree that the overview statement quoted should be qualified. The
existing behavior is that the table listed in the insert is the table upon
which the ON CONFLICT arbiter constraint must exist [1]. This effectively
negates the benefit of leveraging the partitioning scheme as a form of
uniqueness enforcement in lieu of indexed columns. IIUC, the additional
partition constraint is still useful for select queries so its creation
still has merit and leverages that particular benefit of partitioning. But
today, you cannot fully benefit from that dynamic if you wish to leverage
ON CONFLICT during data insertion. An improvement there isn't something
that could be back-patched.
David J.
[1] From the INSERT documentation: "All table_name unique indexes that,
without regard to order, contain exactly the conflict_target-specified
columns/expressions are inferred (chosen) as arbiter indexes."
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2020-11-14 01:26:02 | Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition |
Previous Message | Andres Freund | 2020-11-14 00:28:05 | Re: BUG #16714: INSERT ON CONFLICT DO UPDATE fails to infer constraint if it's not at top-level partition |