X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EB1765298E; Tue, 16 Aug 2005 11:59:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03196-07; Tue, 16 Aug 2005 14:59:37 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 074FA5298C; Tue, 16 Aug 2005 11:59:36 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1E52uW-000641-00; Tue, 16 Aug 2005 10:59:28 -0400 To: "Marc G. Fournier" Cc: pgsql-sql@postgresql.org Subject: Re: ARRAYs and INDEXes ... References: <20050816014906.G1002@ganymede.hub.org> In-Reply-To: <20050816014906.G1002@ganymede.hub.org> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 16 Aug 2005 10:59:28 -0400 Message-ID: <877jemvsfj.fsf@stark.xeocode.com> Lines: 18 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 required=5 tests=[AWL=0.003] X-Spam-Level: X-Archive-Number: 200508/114 X-Sequence-Number: 22342 "Marc G. Fournier" writes: > SELECT * FROM customers WHERE monthly_balance[6] = 0.00; This, like the other poster said, can be accomplished with a set of simple expression indexes. > As an example ... or > > SELECT * FROM customers WHERE 0.00 = any (monthly_balance); This would require a GiST index. Look at the intarray contrib module. I don't think there's any equivalent for other data types. You might have to store these values as fixed precision numbers and divide or multiple by 100 to convert. -- greg