Re: would it be a lot of work, to add optimizations accross unions ?

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: Grzegorz Jaskiewicz <gj(at)pointblue(dot)com(dot)pl>
Cc: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: would it be a lot of work, to add optimizations accross unions ?
Date: 2009-02-28 11:37:55
Message-ID: 87fxhyssfg.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Grzegorz Jaskiewicz <gj(at)pointblue(dot)com(dot)pl> writes:

> Say I have:
>
> select foo (
> select foo from bar1
> union all
> select foo from bar2
> union all
> select foo from bar3
> ...
> ) a order by foo desc limit X;
>
>
> (and I can give you few other examples around the same 'note', say with when
> foo=N in outer subselect)
>
> Would anyone consider such optimization, when postgres will apply the same
> condition to inner queries, providing that their size is substantial?

Well you haven't said what optimization you're looking for here.

I posted a patch to look for an ordered path for members of a union a while
back but it still needed a fair amount of work before it was usable.

The LIMIT can't be pushed into the union unless we do have ordered paths so
that's further down the line. (And even then it would only work if there are
no conditions on there append path.)

And I believe we already do push down where clauses like foo=N.

> Same would actually apply for different subqueries, without union/
> intersect/etc:
>
> select foo( select foo from bar1 ) a where foo in (x,y,z) order by foo desc
> limit N

huh?

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's RemoteDBA services!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Grzegorz Jaskiewicz 2009-02-28 11:49:07 Re: would it be a lot of work, to add optimizations accross unions ?
Previous Message James Pye 2009-02-28 10:51:27 Re: xpath processing brain dead