From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: ARRAYs and INDEXes ... |
Date: | 2005-08-16 05:30:19 |
Message-ID: | 20050816053019.GA6387@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, Aug 16, 2005 at 01:54:13AM -0300, Marc G. Fournier wrote:
>
> CREATE TABLE customers (
> customer_id SERIAL,
> monthly_balance DECIMAL(7,2)[12]
> );
>
> Is it possible to create an INDEX on customers.monthly_balance such that I
> could do something like:
>
> SELECT * FROM customers WHERE monthly_balance[6] = 0.00;
You could use expression indexes, one per month:
CREATE INDEX customers_mb_1_idx ON customers ((monthly_balance[1]));
CREATE INDEX customers_mb_2_idx ON customers ((monthly_balance[2]));
etc.
> SELECT * FROM customers WHERE 0.00 = any (monthly_balance);
Not sure about that one.
--
Michael Fuhr
From | Date | Subject | |
---|---|---|---|
Next Message | Akshay Mathur | 2005-08-16 05:53:06 | Re: sql function: using set as argument |
Previous Message | Marc G. Fournier | 2005-08-16 04:54:13 | ARRAYs and INDEXes ... |