X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 5F3F49FA12F for ; Thu, 1 Jun 2006 20:22:22 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 80741-03 for ; Thu, 1 Jun 2006 20:22:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id B3FDC9FA040 for ; Thu, 1 Jun 2006 20:22:15 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id 5487E56423; Thu, 1 Jun 2006 18:22:13 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Thu, 1 Jun 2006 18:22:13 -0500 Date: Thu, 1 Jun 2006 18:22:12 -0500 From: "Jim C. Nasby" To: Tom Lane Cc: Josh Berkus , pgsql-hackers@postgresql.org Subject: Re: More thoughts about planner's cost estimates Message-ID: <20060601232212.GX53487@pervasive.com> References: <14821.1149104747@sss.pgh.pa.us> <447F23A9.1090503@agliodbs.com> <14438.1149189309@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <14438.1149189309@sss.pgh.pa.us> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060601:tgl@sss.pgh.pa.us::bvctJUbJqic3lMF8:00000000000000000000 0000000000000000000000000vH0 X-Hashcash: 1:20:060601:josh@agliodbs.com::NwzAZ43Uxh/WpQmN:00000000000000000000 00000000000000000000000014of X-Hashcash: 1:20:060601:pgsql-hackers@postgresql.org::gXJNaFEKx8kVkgXn:000000000 0000000000000000000000001/ED X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/28 X-Sequence-Number: 84261 On Thu, Jun 01, 2006 at 03:15:09PM -0400, Tom Lane wrote: > These would all be nice things to know, but I'm afraid it's pie in the > sky. We have no reasonable way to get those numbers. (And if we could > get them, there would be another set of problems, namely plan instability: > the planner's choices would become very difficult to reproduce.) Speaking of plan instability, something that's badly needed is the ability to steer away from query plans that *might* be the most optimal, but also will fail horribly should the cost estimates be wrong. People generally don't care about getting the absolutely most optimal plan; they do care about NOT getting a plan that's horribly bad. One possible way to do this would be to have the estimator calculate a worst-case cost to go along with the best case cost, or maybe even 3 numbers: ideal, what we think will happen, and worst-case. I know that index scans already have that information, at least in the form of cost for a plan with 0 correlation and one with perfect correlation. Does anyone have any experience developing genetic algorithms? I think coming up with cost estimators might be an ideal use for that technology... -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461