X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 721FC534FD for ; Tue, 12 Apr 2005 01:34:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09407-02 for ; Tue, 12 Apr 2005 04:34:27 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 053935346D for ; Tue, 12 Apr 2005 01:34:25 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j3C4YM2A020407 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 11 Apr 2005 22:34:24 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j3C4YMhu076249; Mon, 11 Apr 2005 22:34:22 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j3C4YLDk076248; Mon, 11 Apr 2005 22:34:21 -0600 (MDT) (envelope-from mfuhr) Date: Mon, 11 Apr 2005 22:34:21 -0600 From: Michael Fuhr To: Bruno Wolff III , pgsql-docs@postgresql.org Subject: Re: Possible copy error in explain example Message-ID: <20050412043421.GA60302@winnie.fuhr.org> References: <20050412044001.GA32308@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050412044001.GA32308@wolff.to> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/15 X-Sequence-Number: 2945 On Mon, Apr 11, 2005 at 11:40:01PM -0500, Bruno Wolff III wrote: > I was looking at: > http://candle.pha.pa.us/main/writings/pgsql/sgml/performance-tips.html > > And noticed in the first example that it is claimed the cost estimate > is 233 disk block reads. However, "233" doesn't appear in the explain > output shown. I think that "233" is supposed to match the "333" in > the explain output, but I am not 100% sure. This part? This is about as straightforward as it gets. If you do SELECT * FROM pg_class WHERE relname = 'tenk1'; you will find out that tenk1 has 233 disk pages and 10000 rows. So the cost is estimated at 233 page reads, defined as costing 1.0 apiece, plus 10000 * cpu_tuple_cost which is currently 0.01 (try SHOW cpu_tuple_cost). Doesn't that work out to (233 * 1.0) + (10000 * 0.01) = 233.0 + 100.0 = 333.0 or am I missing something? -- Michael Fuhr http://www.fuhr.org/~mfuhr/