Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TjIKs-0006Pk-Mt for pgsql-performance@arkaria.postgresql.org; Thu, 13 Dec 2012 23:37:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TjIKs-0007f2-7z for pgsql-performance@arkaria.postgresql.org; Thu, 13 Dec 2012 23:37:02 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TjIKr-0007ex-EI for pgsql-performance@postgresql.org; Thu, 13 Dec 2012 23:37:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TjIKm-0000Z2-OF for pgsql-performance@postgresql.org; Thu, 13 Dec 2012 23:37:00 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id qBDNassS014686; Thu, 13 Dec 2012 18:36:54 -0500 (EST) From: Tom Lane To: Evgeny Shishkin cc: Andrew Dunstan , Claudio Freire , AI Rumman , postgres performance list Subject: Re: Why does the number of rows are different in actual and estimated. In-reply-to: References: <50CA586A.30008@dunslane.net> <50CA6036.6000107@dunslane.net> Comments: In-reply-to Evgeny Shishkin message dated "Fri, 14 Dec 2012 03:13:29 +0400" Date: Thu, 13 Dec 2012 18:36:54 -0500 Message-ID: <14685.1355441814@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Evgeny Shishkin writes: > On Dec 14, 2012, at 3:09 AM, Andrew Dunstan wrote: >> Well, it looks like it's choosing a join order that's quite a bit different from the way the query is expressed, so the OP might need to play around with forcing the join order some. > OP joins 8 tables, and i suppose join collapse limit is set to default 8. I thought postgresql's optimiser is not mysql's. It's not obvious to me that there's anything very wrong with the plan. An 8-way join that produces 150K rows is unlikely to run in milliseconds no matter what the plan. The planner would possibly have done the last join step differently if it had had a better rowcount estimate, but even if that were free the query would still have been 7 seconds (vs 8.5). regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance