From: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> |
---|---|
To: | Jaime Casanova <jaime(dot)casanova(at)2ndquadrant(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: FailedAssertion on partprune |
Date: | 2018-07-24 07:16:24 |
Message-ID: | CAKJS1f9MQd5ntg6xXg7jJe0jB_bWvCDRmaH6yNzZGF+TVa5M=A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 24 July 2018 at 16:55, Jaime Casanova <jaime(dot)casanova(at)2ndquadrant(dot)com> wrote:
> I was trying sqlsmith on REL_11_STABLE (commit
> 1b957e59b92dc44c14708762f882d7910463a9ac) with a database i have at
> hand, and got an assertion failure.
> It seems to happen during planning on prunning time but only when
> tables get bigger than certain size.
>
> I configured it with "--enable-debug --enable-depend
> --enable-cassert", attached is the backtrace and a script to reproduce
> the problem.
It looks like an AppendPath which has a non-NIL partitioned_rels List
won't always only contain leaf partitions as subpaths. The plan that
the planner is trying to make here is:
https://explain.depesz.com/s/26zj
In this case, the 2nd to 5th Append subplan's parents are actually
partitioned tables rather than leaf partitions.
make_partition_pruneinfo() assumes these will always be leaf
partitions. Looking more closely at accumulate_append_subpath() I can
see that there are cases where it won't pull sub-Append paths into the
main Append. That's what we're seeing in this plan.
The fix is either to have make_partition_pruneinfo() return NIL to
disable run-time pruning when any of the subpaths are not a leaf
partition (it might be a good safety precaution regardless), or we
could maybe think harder about what can be done in
accumulate_append_subpath() to flatten the Append/MergeAppend paths in
this case.
I've attached a patch for the former.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachment | Content-Type | Size |
---|---|---|
run-time_prune_tablesample_fix.patch | application/octet-stream | 1.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Masahiko Sawada | 2018-07-24 07:47:41 | Re: [HACKERS] Restricting maximum keep segments by repslots |
Previous Message | Pavel Stehule | 2018-07-24 06:31:52 | Re: How can we submit code patches that implement our (pending) patents? |