Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T1ntX-00052C-MQ for pgsql-performance@postgresql.org; Thu, 16 Aug 2012 00:25:03 +0000 Received: from smtp.01.com ([199.36.142.181]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T1ntT-00050d-Fi for pgsql-performance@postgresql.org; Thu, 16 Aug 2012 00:25:03 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp-out-1.01.com (Postfix) with ESMTP id 9370F2940CC; Wed, 15 Aug 2012 19:24:57 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-1.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-1.01.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H10IMS4PHNL6; Wed, 15 Aug 2012 19:24:57 -0500 (CDT) Received: from smtp.01.com (localhost.localdomain [127.0.0.1]) by smtp-out-1.01.com (Postfix) with ESMTP id 6F1C9294239; Wed, 15 Aug 2012 19:24:57 -0500 (CDT) Received: from Sidney-Stratton.local (70-36-143-92.dsl.dynamic.sonic.net [70.36.143.92]) by smtp-out-1.01.com (Postfix) with ESMTPSA id 3127B2940CC; Wed, 15 Aug 2012 19:24:57 -0500 (CDT) Message-ID: <502C3DE2.9060703@agliodbs.com> Date: Wed, 15 Aug 2012 17:25:06 -0700 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Tom Lane CC: pgsql-performance@postgresql.org Subject: Re: 7k records into Sort node, 4.5m out? References: <32B51AEA-E940-40CF-BA54-C7D4E3E1F0D7@thebuild.com> <10304.1344910305@sss.pgh.pa.us> <623F2FF3-B79D-419A-929A-41C707DD5EA3@thebuild.com> <16268.1345063872@sss.pgh.pa.us> <502C0E6B.1040402@agliodbs.com> <20520.1345067076@sss.pgh.pa.us> In-Reply-To: <20520.1345067076@sss.pgh.pa.us> X-Enigmail-Version: 1.4.3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201208/91 X-Sequence-Number: 47629 > If you can show us the anonymized query plan, why not the anonymized query? > It doesn't look like it could be all that complicated. It's not: SELECT COUNT(*) FROM "user" INNER JOIN "house" ON ("user"."house_id" = "house"."id") LEFT OUTER JOIN "district" ON ("house"."district_id" = "district"."id") WHERE ("user"."status" = 0 AND ("district"."update_status" = 2 OR "district"."update_status" = 3 ) AND ("user"."valid" = 1 OR "user"."valid" = 3 ) AND "district"."is_test" = false ); However, since the anonymization above doesn't quite match that used in the EXPLAIN plan, I'm not sure what you'll get out of it. And yes, we know that the outer join is being invalidated. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com