Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 387B9B5DBE5 for ; Tue, 6 Sep 2011 00:30:21 -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 13435-04 for ; Tue, 6 Sep 2011 03:30:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sam.nabble.com (sam.nabble.com [216.139.236.26]) by mail.postgresql.org (Postfix) with ESMTP id A3982B5DBC1 for ; Tue, 6 Sep 2011 00:30:13 -0300 (ADT) Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1R0mMW-0001Yz-4h for pgsql-performance@postgresql.org; Mon, 05 Sep 2011 20:30:12 -0700 Date: Mon, 5 Sep 2011 20:30:12 -0700 (PDT) From: Jayadevan To: pgsql-performance@postgresql.org Message-ID: <1315279812138-4773061.post@n5.nabble.com> In-Reply-To: References: <4E6345520200002500040BD6@gw.wicourts.gov> <12017.1315149499@sss.pgh.pa.us> <1315159591749-4768047.post@n5.nabble.com> <0b5904ed666013250682b895d8266324.squirrel@sq.gransy.com> Subject: Re: Query performance issue MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.778 tagged_above=-10 required=5 tests=BAYES_00=-1.9, URI_HEX=1.122 X-Spam-Level: X-Archive-Number: 201109/53 X-Sequence-Number: 44829 Based on my initial hunch that something resulting from all the ALTERS was making PostgreSQL planner end up with bad plans, I tried a pg_dump and pg_restore. Now the 'bad' query comes back in 70 seconds (compared to 20 minutes earlier) and the rewritten query still comes back in 2 seconds. So we will stick with the re-written query. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Query-performance-issue-tp4753453p4773061.html Sent from the PostgreSQL - performance mailing list archive at Nabble.com.