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-28 15:06:50
Message-ID: 20140228150650.GA3375027@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 28, 2014 at 02:35:50PM +0900, Kyotaro HORIGUCHI wrote:
> At Thu, 27 Feb 2014 21:53:52 -0500, Noah Misch wrote
> > On Thu, Feb 27, 2014 at 05:33:47PM -0500, Tom Lane wrote:
> > > I wonder whether we should consider adding a pass to flatten any nested
> > > appendrels after we're done creating them all.
> >
> > We did consider that upthread. It's a valid option, but I remain more
> > inclined to teach pull_up_subqueries() to preserve flatness just like
> > expand_inherited_tables() will.
>
> Yes, the old dumped version of typ2 patch did so. It flattened
> appendrel tree for the query prpoerly. Let me hear the reson you
> prefer to do so.

Having reviewed my upthread reasoning for preferring one of those two
approaches over the other, it's a weak preference. They have similar runtime
costs. Putting the logic with the code that creates appendrels reduces the
number of code sites one must examine to reason about possible plan
structures. We might not flatten RTE_RELATION appendrel parents exactly the
same way we flatten RTE_SUBQUERY appendrel parents. I would tend to leave
inh=true for the former, for reasons explained in my notes on v7, but set
inh=false for the latter to save needless work. On the other hand, a
flattening pass is less code overall and brings an attractive
uniformity-by-default to the area.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2014-02-28 15:25:20 Re: Patch: show relation and tuple infos of a lock to acquire
Previous Message Karol Trzcionka 2014-02-28 14:59:41 Re: [HACKERS] GSoC 2014 - mentors, students and admins