X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1BF224764A9 for ; Tue, 6 May 2003 09:07:50 -0400 (EDT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by postgresql.org (Postfix) with SMTP id 458EA4763CE for ; Tue, 6 May 2003 09:07:49 -0400 (EDT) Received: (qmail 43944 invoked by uid 1001); 6 May 2003 13:07:47 -0000 Date: Tue, 6 May 2003 08:07:47 -0500 From: "Jim C. Nasby" To: Josh Berkus Cc: Tom Lane , pgsql-performance , pgsql-hackers@postgresql.org Subject: Re: [HACKERS] Hypothetical suggestions for planner, indexing improvement Message-ID: <20030506080747.C66185@flake.decibel.org> Reply-To: jim@nasby.net References: <200305051219.58955.josh@agliodbs.com> <22292.1052195133@sss.pgh.pa.us> <200305052133.33680.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <200305052133.33680.josh@agliodbs.com>; from josh@agliodbs.com on Mon, May 05, 2003 at 09:33:33PM -0700 X-Operating-System: FreeBSD 4.8-RELEASE i386 X-Distributed: Join the Effort! http://www.distributed.net X-Spam-Status: No, hits=-36.2 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,REFERENCES, REPLY_WITH_QUOTES,SIGNATURE_SHORT_SPARSE,USER_AGENT_MUTT 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/61 X-Sequence-Number: 1840 On Mon, May 05, 2003 at 09:33:33PM -0700, Josh Berkus wrote: > EXISTS is more flexible than IN; how can you do a 3-column corellation on an > IN clause? It would be nice to add support for multi-column IN.. WHERE (a, b, c) IN (SELECT a, b, c ...) BTW, does postgresql handle IN and EXISTS differently? Theoretically if the optimizer was good enough you could transform one to the other and not worry about it. Whenever possible, I try and use IN when the subselect will return a very small number of rows, since IN might be faster than EXISTS in that case, though it seems most optimizers tend to fall apart when they see ORs, and a lot of databases transform IN to a OR b OR c. -- 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?"