On Wed, Mar 2, 2011 at 9:11 AM, Thom Brown <thom@xxxxxxxxx> wrote: > On 2 March 2011 19:38, Robert Haas <robertmhaas@xxxxxxxxx> wrote: >> On Thu, Feb 24, 2011 at 11:38 AM, Dave Johansen <davejohansen@xxxxxxxxx> wrote: >>> I also just noticed that an ORDER BY x LIMIT n optimization is not pushed >>> down through the UNION ALL as well. I understand that this may be a little >>> trickier because the ORDER BY and LIMIT would need to be applied to the >>> subqueries and then re-applied after the APPEND, >> >> PostgreSQL 9.1 will know how to do this, FWIW. > > Out of curiosity, what was the commit for this? 11cad29c91524aac1d0b61e0ea0357398ab79bf8 Support MergeAppend plans, to allow sorted output from append relations. 034967bdcbb0c7be61d0500955226e1234ec5f04 Reimplement planner's handling of MIN/MAX aggregate optimization. 947d0c862c895618a874344322e7b07c9df05cb2 Use appendrel planning logic for top-level UNION ALL structures. 6fbc323c8042303a737028f9da7616896bccc517 Further fallout from the MergeAppend patch. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance