X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3CFCB9DC9E5 for ; Tue, 21 Mar 2006 09:30:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69364-10 for ; Tue, 21 Mar 2006 09:30:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mnc.ch (62-2-77-205.business.cablecom.ch [62.2.77.205]) by postgresql.org (Postfix) with ESMTP id F13379DC8DE for ; Tue, 21 Mar 2006 09:30:24 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id EC268A8323; Tue, 21 Mar 2006 14:30:37 +0100 (CET) Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail.test.lan [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 14370-06; Tue, 21 Mar 2006 14:30:34 +0100 (CET) Received: from meuh.mnc.lan (62-2-77-204.business.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id 8B873A82B2; Tue, 21 Mar 2006 14:30:34 +0100 (CET) Received: by meuh.mnc.lan (Postfix, from userid 1000) id 4CFB0183669; Tue, 21 Mar 2006 14:30:22 +0100 (CET) To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org Subject: Re: planner with index scan cost way off actual cost, advices to tweak cost constants? References: <87ek11gz69.fsf@meuh.mnc.lan> <1d4e0c10603180220se128a79r71534db9349bd746@mail.gmail.com> <87hd5tmt1z.fsf@meuh.mnc.lan> <20060321095700.GX15742@pervasive.com> <87irq8kswd.fsf@meuh.mnc.lan> <20060321115835.GN15742@pervasive.com> X-Hashcash: 1:20:060321:jnasby@pervasive.com::BIAsDcjUEYAH/6Py:000000000000000000000000000000000000000004OcN X-Hashcash: 1:20:060321:pgsql-performance@postgresql.org::GQf+FIzVOWfNT1/G:000000000000000000000000000003zbQ From: Guillaume Cottenceau Date: 21 Mar 2006 14:30:22 +0100 In-Reply-To: <20060321115835.GN15742@pervasive.com> Message-ID: <8764m8kjrl.fsf@meuh.mnc.lan> Lines: 23 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: amavisd-new at mnc.ch X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.101 required=5 tests=[AWL=0.101] X-Spam-Score: 0.101 X-Spam-Level: X-Archive-Number: 200603/401 X-Sequence-Number: 17838 "Jim C. Nasby" writes: > If you feel like running some tests, you need to change > > run_cost += max_IO_cost + csquared * (min_IO_cost - max_IO_cost); > > in src/backend/optimizer/path/costsize.c to something like > > run_cost += max_IO_cost + abs(indexCorrelation) * (min_IO_cost - max_IO_cost); Short after the beginning of a discussion about planner associating too high cost for index scan, I'm suggested to change source-code.. I'm already frightened about the near future :) > That might not produce a perfect cost estimate, but I'll wager that it > will be substantially better than what's in there now. FYI, see also > http://archives.postgresql.org/pgsql-performance/2005-04/msg00669.php Sad that Tom didn't share his thoughts about your cost algorithm question in this message. -- Guillaume Cottenceau