X-Original-To: pgsql-general-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id C09FF9FA5D8 for ; Wed, 14 Jun 2006 10:57:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 18561-05 for ; Wed, 14 Jun 2006 10:57:02 -0300 (ADT) 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 CEFB99F9CAA for ; Wed, 14 Jun 2006 10:57:02 -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 k5EDutbQ023346; Wed, 14 Jun 2006 09:56:55 -0400 (EDT) To: "Milen Kulev" cc: "'Jim C. Nasby'" , pgsql-general@postgresql.org Subject: Re: Partitioning... In-reply-to: <010801c68fa8$46744320$0a00a8c0@trivadis.com> References: <010801c68fa8$46744320$0a00a8c0@trivadis.com> Comments: In-reply-to "Milen Kulev" message dated "Wed, 14 Jun 2006 13:47:12 +0200" Date: Wed, 14 Jun 2006 09:56:55 -0400 Message-ID: <23345.1150293415@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/567 X-Sequence-Number: 96939 "Milen Kulev" writes: > Thanks Jim, the "trick" worked for me ! >> You might need to add an ORDER BY to the subquery to ensure >> PostgreSQL doesn't pull it into the main query. Actually, the usual trick is "OFFSET 0", which works just as well as an optimization fence and doesn't force any significant extra work. Of course, if you *need* an ORDER BY then that's what to use, but it's overkill if you just want to prevent flattening the subquery. regards, tom lane