Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TjIY0-0006dJ-MG for pgsql-performance@arkaria.postgresql.org; Thu, 13 Dec 2012 23:50:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TjIXz-0004MH-Sl for pgsql-performance@arkaria.postgresql.org; Thu, 13 Dec 2012 23:50:35 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TjIXo-0004M4-UK for pgsql-performance@postgresql.org; Thu, 13 Dec 2012 23:50:25 +0000 Received: from mail-lb0-f174.google.com ([209.85.217.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TjIXn-0000mG-2Z for pgsql-performance@postgresql.org; Thu, 13 Dec 2012 23:50:23 +0000 Received: by mail-lb0-f174.google.com with SMTP id gi11so2301249lbb.19 for ; Thu, 13 Dec 2012 15:50:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=/Qu9TzzlJTsQH/7QZSuxEBOOcTMIQxBafglKUPD7/KM=; b=AKGv8K4xr7rwYVO6RFTrQmo304DQxNiY9WyA3qEC3AK7aGjU6LKS0w+Li7hXuDmGxc cL9z11sLxoBePM+6+tFMLzIMJ2f+/3e4F/U4t0uNg4uOR2s+vihycspvOhbRk4dPJMwX lljW3FHm2PR+s+P7Evm94H7xncaXvCGBH1bnj4/X5H2/Y93nAirXjXNFnY2nKav4LgQG z3hZnL70mOnAm8guFkyjqxrq5d8BP8ugloYaIxJxfPh28SDXyfhOfdUt2nHmb708VwJl TvaIS/WHDStN3jhaSXDB7EBy90+mA8eIxrO+mCe08k5l1MdMpRVIYuP+2G+3/Xo2U+E4 96+A== Received: by 10.152.129.197 with SMTP id ny5mr917126lab.43.1355442621367; Thu, 13 Dec 2012 15:50:21 -0800 (PST) Received: from [192.168.20.5] ([176.195.200.36]) by mx.google.com with ESMTPS id pm16sm1179094lab.8.2012.12.13.15.50.20 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Dec 2012 15:50:21 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: Why does the number of rows are different in actual and estimated. From: Evgeny Shishkin In-Reply-To: <14685.1355441814@sss.pgh.pa.us> Date: Fri, 14 Dec 2012 03:50:19 +0400 Cc: Andrew Dunstan , Claudio Freire , AI Rumman , postgres performance list Content-Transfer-Encoding: quoted-printable Message-Id: <66FFC2DE-017B-4BD7-9E69-6A9982FD4A0E@gmail.com> References: <50CA586A.30008@dunslane.net> <50CA6036.6000107@dunslane.net> <14685.1355441814@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.1499) X-Pg-Spam-Score: -2.6 (--) 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 On Dec 14, 2012, at 3:36 AM, Tom Lane wrote: > 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 diffe= rent from the way the query is expressed, so the OP might need to play arou= nd with forcing the join order some. >=20 >> OP joins 8 tables, and i suppose join collapse limit is set to default 8= . I thought postgresql's optimiser is not mysql's. >=20 > 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). >=20 May be in this case it is. I once wrote to this list regarding similar prob= lem - joining 4 tables, result set are off by 2257 times - 750ms vs less th= en 1ms. Unfortunately the question was not accepted to the list. I spoke to Bruce Momjian about that problem on one local conference, he sai= d shit happens :)=20=20 > regards, tom lane --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance