Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id E9AAB9FA338 for ; Sun, 8 Oct 2006 14:50:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 69679-10 for ; Sun, 8 Oct 2006 17:49:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 87E8A9FB2E5 for ; Sun, 8 Oct 2006 14:49:58 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k98HnVWM025780; Sun, 8 Oct 2006 13:49:31 -0400 (EDT) To: Kyle Bateman cc: pgsql-sql@postgresql.org Subject: Re: PG 8.2beta reordering working for this case? In-reply-to: <45284DBC.3060901@actarg.com> References: <44DF6582.4000806@actarg.com> <82mza77rch.fsf@mid.bfk.de> <44E11E1A.8020507@actarg.com> <27367.1155606817@sss.pgh.pa.us> <44E349BA.4070205@actarg.com> <26676.1155747492@sss.pgh.pa.us> <44E3840E.4080502@actarg.com> <45284DBC.3060901@actarg.com> Comments: In-reply-to Kyle Bateman message dated "Sat, 07 Oct 2006 19:00:44 -0600" Date: Sun, 08 Oct 2006 13:49:31 -0400 Message-ID: <25779.1160329771@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200610/88 X-Sequence-Number: 26477 Kyle Bateman writes: > Is there a way to make the optimizer do this? Sorry, that's not happening for 8.2. Consider using a union all (not union) across the subledg_N tables directly and then joining to that. That boils down to being a partitioning case and I think probably will be covered by the 8.2 improvements. There isn't any understanding of how to commute joins and unions though ... (offhand I'm not even sure of the conditions under which such a thing would be safe). regards, tom lane