Re: UNION ALL with WHERE clause does not use Merge Append

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marti Raudsepp <marti(at)juffo(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: UNION ALL with WHERE clause does not use Merge Append
Date: 2012-08-16 14:59:12
Message-ID: 12520.1345129152@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Marti Raudsepp <marti(at)juffo(dot)org> writes:
> Is this just a planner shortcoming or a bug? Or is there some
> justification for this behavior?

Per the comment in is_safe_append_member():

* It's only safe to pull up the child if its jointree contains exactly
* one RTE, else the AppendRelInfo data structure breaks. The one base RTE
* could be buried in several levels of FromExpr, however.
*
* Also, the child can't have any WHERE quals because there's no place to
* put them in an appendrel. (This is a bit annoying...)

This will probably get fixed someday, but I wouldn't recommend holding
your breath for it.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2012-08-16 15:15:24 Re: [COMMITTERS] pgsql: Clean up the #include mess a little.
Previous Message Bruce Momjian 2012-08-16 14:49:03 Re: pgsql: In docs, change a few cases of "not important" to "unimportant".