From: | Mintoo Lall <tlqmail(at)yahoo(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Using UPPER and TRIM (INDEX usage) |
Date: | 2003-05-26 02:48:29 |
Message-ID: | 20030526024829.32935.qmail@web40204.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi Everybody,
How do I use "TRIM" and "UPPER" both in the SQL statement and still use the index.
I created an index on myTable in the following way
CREATE INDEX index_fname_myTable ON myTable USING btree (upper(fname));
Now the SQL I used was
SELECT * FROM myTable where upper(trim(fname))= 'JOHN':: character varying
The postgresql doesnt use the index on fname in the above case.
But if I use only "UPPER" in the SQL statement, the postgresql uses the index. For eg. SELECT * FROM myTable where upper(fname)= 'JOHN':: character varying
Any help is appreciated.
Regards
Mintoo
---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
From | Date | Subject | |
---|---|---|---|
Next Message | alexandre :: aldeia digital | 2003-05-26 12:44:03 | timestamp field - select error |
Previous Message | Rod Taylor | 2003-05-26 02:37:45 | Re: date interpolation |