X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A8445D1BA91 for ; Mon, 23 Feb 2004 00:18:18 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 97824-08 for ; Sun, 22 Feb 2004 20:18:18 -0400 (AST) Received: from davinci.ethosmedia.com (server228.ethosmedia.com [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id D748AD1B90E for ; Sun, 22 Feb 2004 20:18:14 -0400 (AST) Received: from [216.135.165.74] (HELO 10.1.0.211) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 4476053; Sun, 22 Feb 2004 16:19:24 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: siracusa@mindspring.com, Postgres Performance Subject: Re: Column correlation drifts, index ignored again Date: Sun, 22 Feb 2004 16:17:27 -0800 User-Agent: KMail/1.5.4 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200402221617.27658.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/257 X-Sequence-Number: 5781 John, > I think the key is to get the planner to correctly ballpark the number of > rows in the date range. If it does, I can't imagine it ever deciding to > read 1,000,000 rows instead of 1,000 with any sane "cost" setting. I'm > assuming the defaults are sane :) The default for random_page_cost is sane, but very conservative; it's pretty much assuming tables that are bigger than RAM and a single IDE disk. If your setup is better than that, you can lower it. For example, in the ideal case (database fits in RAM, fast RAM, CPU, and random seek on the disk), you can lower it to 1.5. For less ideal situations, 1.8 to 2.5 is reasonable on high-end hardware. -- -Josh Berkus Aglio Database Solutions San Francisco