X-Original-To: pgsql-hackers@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 76F2F475CBC; Tue, 6 May 2003 00:36:53 -0400 (EDT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id CC9034763DA; Tue, 6 May 2003 00:36:45 -0400 (EDT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3011355; Mon, 05 May 2003 21:36:49 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Tom Lane Subject: Re: Hypothetical suggestions for planner, indexing improvement Date: Mon, 5 May 2003 21:33:33 -0700 User-Agent: KMail/1.4.3 Cc: pgsql-performance , pgsql-hackers@postgresql.org References: <200305051219.58955.josh@agliodbs.com> <22292.1052195133@sss.pgh.pa.us> In-Reply-To: <22292.1052195133@sss.pgh.pa.us> MIME-Version: 1.0 Message-Id: <200305052133.33680.josh@agliodbs.com> Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-32.4 required=5.0 tests=BAYES_01,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_KMAIL autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/94 X-Sequence-Number: 38601 Tom, > 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. Yes. It would also make FKs something more than just an annoying (and slow= )=20 constraint in PostgreSQL. And it would be a performance feature that most= =20 other RDBMSs don't have ;-) > I'm not sure about the long-term usefulness of optimizing EXISTS per se. > Seems to me that a lot of the present uses of EXISTS are workarounds > for Postgres' historic mistreatment of IN ... which we've attacked more > directly for 7.4. But cross-column correlations are certainly useful > for estimating join sizes in general. EXISTS is more flexible than IN; how can you do a 3-column corellation on a= n=20 IN clause? The reason that I mention EXISTS is because that's where the lack of=20 cross-column corellation is most dramatic; the planner seems to estimate a= =20 flat 50% for EXISTS clauses regardless of the content. --=20 Josh Berkus Aglio Database Solutions San Francisco