Re: UNION ALL on partitioned tables won't use indices.

From: Noah Misch <noah(at)leadboat(dot)com>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, peter_e(at)gmx(dot)net, robertmhaas(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: UNION ALL on partitioned tables won't use indices.
Date: 2014-02-27 14:51:38
Message-ID: 20140227145138.GB3260493@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 27, 2014 at 07:30:57PM +0900, Kyotaro HORIGUCHI wrote:
> Thank you for the labor for polishing this patch.
>
> I have no obvious objection at a glance on this new patch.
>
> I agree to commit this if you this is pertinent to commit except
> for the issue newly revealed by this patch. Though could you let
> me have some more time to examine this by myself and fully
> understand the changes what you made?

Yes; waiting several days is no problem.

> At Wed, 26 Feb 2014 23:29:35 -0500, Noah Misch wrote
> > An alternative was
> > to introduce a new RTE flag, say "append". An inheritance parent under a
> > UNION ALL would have append = false, inh = true; other inheritance parent RTEs
> > would have append = true, inh = true; an RTE for UNION ALL itself would have
> > append = true, inh = false.
>
> I think that kind of complexity is not necessary for this issue.

Agreed.

> > Incidentally, I tried adding an assertion that append_rel_list does not show
> > one appendrel as a direct child of another. The following query, off-topic
> > for the patch at hand, triggered that assertion:
> >
> > SELECT 0 FROM (SELECT 0 UNION ALL SELECT 0) t0
> > UNION ALL
> > SELECT 0 FROM (SELECT 0 UNION ALL SELECT 0) t0;
>
> This seems not to crash unless this patch is applied, but itself
> doesn't seem to be a bug.

To my knowledge, the query does not crash the server under any patch provided
on this thread.

> I think it should be cured along with
> this patch even if it is not the issue of this patch.

That would require changing rather different code, probably something in the
vicinity of pull_up_subqueries(). I'll leave it for another patch.

--
Noah Misch
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-02-27 16:06:00 Re: Changeset Extraction v7.6.1
Previous Message Tom Lane 2014-02-27 14:36:33 Re: Unfortunate choice of short switch name in pgbench