Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 6AA1BB5DC04 for ; Fri, 29 Jul 2011 14:40:35 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 65576-07 for ; Fri, 29 Jul 2011 17:40:29 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id D6DDEB5D91F for ; Fri, 29 Jul 2011 14:40:28 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p6THeRQp028961; Fri, 29 Jul 2011 13:40:28 -0400 (EDT) To: Li Jin cc: pgsql-performance@postgresql.org Subject: Re: Performance penalty when using WITH In-reply-to: <339959BC-3A27-4269-8A3E-4C157EBABB86@tripadvisor.com> References: <339959BC-3A27-4269-8A3E-4C157EBABB86@tripadvisor.com> Comments: In-reply-to Li Jin message dated "Thu, 28 Jul 2011 17:00:06 -0400" Date: Fri, 29 Jul 2011 13:40:27 -0400 Message-ID: <28960.1311961227@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.092 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-1.192 X-Spam-Level: X-Archive-Number: 201107/227 X-Sequence-Number: 44439 Li Jin writes: > Anyone knows why the planner is doing this? WITH is an optimization fence. This is intentional and documented. regards, tom lane