Re: [HACKERS] Repeating Append operation

2010-03-23 Thread Robert Haas
On Tue, Mar 23, 2010 at 2:09 PM, Gurjeet Singh wrote: > On Sun, Mar 21, 2010 at 4:29 PM, Robert Haas wrote: >> >> On Fri, Mar 19, 2010 at 2:09 PM, Gurjeet Singh >> wrote: >> >     Is there a way to avoid this double evaluation? >> >> Maybe with a CTE? >> >> WITH x AS (...) SELECT ... >> >> It do

Re: [HACKERS] Repeating Append operation

2010-03-23 Thread Gurjeet Singh
On Sun, Mar 21, 2010 at 4:29 PM, Robert Haas wrote: > On Fri, Mar 19, 2010 at 2:09 PM, Gurjeet Singh > wrote: > > Is there a way to avoid this double evaluation? > > Maybe with a CTE? > > WITH x AS (...) SELECT ... > > It does look like surprising behavior. > It was discussed on the IRC tha

Re: [HACKERS] Repeating Append operation

2010-03-21 Thread Robert Haas
On Fri, Mar 19, 2010 at 2:09 PM, Gurjeet Singh wrote: >     Is there a way to avoid this double evaluation? Maybe with a CTE? WITH x AS (...) SELECT ... It does look like surprising behavior. ...Robert -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to y

[HACKERS] Repeating Append operation

2010-03-19 Thread Gurjeet Singh
Hi all, explain select v from ( select array( select 1 union all select 2) as v from (select 1) ) as s where v is not null; The plan looks like: QUERY PLAN Result (cost=0.08..0.10 rows=1 wid