Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id EF2469FBDBE for ; Wed, 9 May 2007 08:58:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 91065-01 for ; Wed, 9 May 2007 08:58:28 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from gauss.credativ.com (ipx11302.ipxserver.de [212.112.227.254]) by postgresql.org (Postfix) with ESMTP id 376489FBDAE for ; Wed, 9 May 2007 08:58:33 -0300 (ADT) Received: from hawking.credativ.lan (unknown [87.139.82.80]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by gauss.credativ.com (Postfix) with ESMTP id 91E28D782D; Wed, 9 May 2007 13:58:30 +0200 (CEST) From: Peter Eisentraut To: Tom Lane Subject: Re: Nested loops overpriced Date: Wed, 9 May 2007 13:58:25 +0200 User-Agent: KMail/1.9.5 Cc: pgsql-performance@postgresql.org References: <200705081722.16731.peter_e@gmx.net> <1987.1178639593@sss.pgh.pa.us> In-Reply-To: <1987.1178639593@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200705091358.25748.peter_e@gmx.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/181 X-Sequence-Number: 24571 Am Dienstag, 8. Mai 2007 17:53 schrieb Tom Lane: > Hmm, I'd have expected it to discount the repeated indexscans a lot more > than it seems to be doing for you. As an example in the regression > database, note what happens to the inner indexscan cost estimate when > the number of outer tuples grows: I can reproduce your results in the regression test database. 8.2.1 and 8.2.4 behave the same. I checked the code around cost_index(), and the assumptions appear to be correct (at least this query doesn't produce wildly unusual data). Apparently, however, the caching effects are much more significant than the model takes into account. -- Peter Eisentraut http://developer.postgresql.org/~petere/