Re: [PERFORM] Max on union

2009-01-29 Thread Robert Haas
On Thu, Jan 29, 2009 at 10:58 AM, wrote: > Hi, > > If I have a view like: > > create view X as ( > select x from A > union all > select x from B) > > and do > > select max(x) from X > > I get a plan like: > > Aggregate > Append > Seq Scan on A > Seq Scan on B > > If A and B are indexed

[PERFORM] Max on union

2009-01-29 Thread anders.blaagaard
Hi, If I have a view like: create view X as ( select x from A union all select x from B) and do select max(x) from X I get a plan like: Aggregate Append Seq Scan on A Seq Scan on B If A and B are indexed on x, I can get the result much faster as: select max(x) from ( selec