X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 45BD94764EB for ; Tue, 6 May 2003 09:10:33 -0400 (EDT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by postgresql.org (Postfix) with SMTP id DA7A8474E42 for ; Tue, 6 May 2003 09:10:31 -0400 (EDT) Received: (qmail 47005 invoked by uid 1001); 6 May 2003 13:10:35 -0000 Date: Tue, 6 May 2003 08:10:35 -0500 From: "Jim C. Nasby" To: Tom Lane Cc: josh@agliodbs.com, pgsql-performance , pgsql-hackers@postgresql.org Subject: Re: [HACKERS] Hypothetical suggestions for planner, indexing improvement Message-ID: <20030506081035.D66185@flake.decibel.org> Reply-To: jim@nasby.net References: <200305051219.58955.josh@agliodbs.com> <22292.1052195133@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <22292.1052195133@sss.pgh.pa.us>; from tgl@sss.pgh.pa.us on Tue, May 06, 2003 at 12:25:33AM -0400 X-Operating-System: FreeBSD 4.8-RELEASE i386 X-Distributed: Join the Effort! http://www.distributed.net X-Spam-Status: No, hits=-38.6 required=5.0 tests=BAYES_10,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,SIGNATURE_SHORT_SPARSE, USER_AGENT_MUTT version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/62 X-Sequence-Number: 1841 On Tue, May 06, 2003 at 12:25:33AM -0400, Tom Lane wrote: > Josh Berkus writes: > > THE IDEA: The planner should keep statistics on the correlation of foreign > > keys and apply them to the expected row counts for EXISTS clause limitations, > > and possibly for other query types as well. > > It's a thought. Keeping complete cross-column correlation stats (for > every combination of columns in the DB) is obviously out of the > question. If you're gonna do it you need a heuristic to tell you which > combinations of columns are worth keeping track of --- and foreign-key > relationships seem like a reasonable guide to the interesting > combinations. What if the optimizer kept on-going statistics on what columns were used in joins to what other columns? Over time this would allow analyze to determine on it's own what cross-column correlation stats should be kept. -- Jim C. Nasby (aka Decibel!) jim@nasby.net Member: Triangle Fraternity, Sports Car Club of America Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?"