Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2554747665E for ; Tue, 29 Oct 2002 15:30:09 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 9AB394762A8; Tue, 29 Oct 2002 15:30:06 -0500 (EST) Received: by davinci.ethosmedia.com (CommuniGate Pro PIPE 3.5.9) with PIPE id 1804003; Tue, 29 Oct 2002 12:32:05 -0800 X-Spam-Status: Scanner Called Received: from [216.135.165.74] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.9) with HTTP id 1804001; Tue, 29 Oct 2002 12:32:02 -0800 From: "Josh Berkus" Subject: Re: BOOLEAN question To: Tom Lane , josh@agliodbs.com Cc: pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Tue, 29 Oct 2002 12:32:02 -0800 Message-ID: In-Reply-To: <22789.1035916054@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Spam-Status: No, hits=-4.2 required=6.0 tests=IN_REP_TO,AWL version=2.20 X-Spam-Level: X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/393 X-Sequence-Number: 10110 Tom, > Perhaps > SELECT true = ANY (SELECT boolcol FROM ...); > or > SELECT true IN (SELECT boolcol FROM ...); > > Which is not to say that MAX(bool) might not be a nicer solution; > but you can definitely do it with SQL-spec constructs. Based on some rough testing, SELECT true = ANY ( SELECT boolcol FROM complex query ) Is marginlly faster than SELECT max(boolcol) FROM complex query With a custom MAX(boolean) function. So I'll stick to ANY(). -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco