From: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | "bhanu udaya *EXTERN*" <udayabhanu1984(at)hotmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Postgres case insensitive searches |
Date: | 2013-06-28 12:32:00 |
Message-ID: | A737B7A37273E048B164557ADEF4A58B17BC1C74@ntex2010a.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-support pgsql-general |
bhanu udaya wrote:
> What is the best way of doing case insensitive searches in postgres using Like.
Table "laurenz.t"
Column | Type | Modifiers
--------+---------+-----------
id | integer | not null
val | text | not null
Indexes:
"t_pkey" PRIMARY KEY, btree (id)
CREATE INDEX t_val_ci_ind ON t ((upper(val) text_pattern_ops);
ANALYZE t;
EXPLAIN SELECT id FROM t WHERE upper(val) LIKE 'AB%';
QUERY PLAN
------------------------------------------------------------------------------
Index Scan using t_val_ci_ind on t (cost=0.01..8.28 rows=1 width=4)
Index Cond: ((upper(val) ~>=~ 'AB'::text) AND (upper(val) ~<~ 'AC'::text))
Filter: (upper(val) ~~ 'AB%'::text)
(3 rows)
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Eike Dierks | 2013-06-28 22:17:35 | Feature: Object Browser Open Quickly |
Previous Message | bhanu udaya | 2013-06-28 10:21:33 | Postgres case insensitive searches |
From | Date | Subject | |
---|---|---|---|
Next Message | David Greco | 2013-06-28 12:45:01 | AFTER triggers and constraints |
Previous Message | David Greco | 2013-06-28 12:30:14 | Re: auto_explain & FDW |