Re: UNION ALL on partitioned tables won't use indices. - Mailing list pgsql-hackers

From Noah Misch
Subject Re: UNION ALL on partitioned tables won't use indices.
Date
Msg-id 20140227145138.GB3260493@tornado.leadboat.com
Whole thread Raw
In response to Re: UNION ALL on partitioned tables won't use indices.  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Unfortunate choice of short switch name in pgbench
Next
From: Andres Freund
Date:
Subject: Re: Changeset Extraction v7.6.1