Problem with text_pattern_ops

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Problem with text_pattern_ops
Date: 2005-07-26 19:39:16
Message-ID: 42E69164.4050607@selectacast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have this index:

"directory_lower_username_seg_key" unique, btree (lower(username)
text_pattern_ops, seg)

... but my query refuses to use that index.
[local]:owl=>explain select * from directory where lower(username) =
'jks(at)selectacast(dot)net';
QUERY PLAN
---------------------------------------------------------------
Seq Scan on directory (cost=0.00..860.75 rows=102 width=575)
Filter: (lower(username) = 'jks(at)selectacast(dot)net'::text)
(2 rows)
[local]:owl=>CREATE INDEX directory_lower_username_seg_key1 ON directory
(lower(username),seg);
CREATE INDEX
[local]:owl=>explain select * from directory where lower(username) =
'jks(at)selectacast(dot)net';
QUERY PLAN
---------------------------------------------------------------------------------------------------------
Index Scan using directory_lower_username_seg_key1 on directory
(cost=0.00..377.01 rows=102 width=575)
Index Cond: (lower(username) = 'jks(at)selectacast(dot)net'::text)
(2 rows)

[local]:owl=>select version();
version
---------------------------------------------------------------------------------------------------------
PostgreSQL 7.4.7 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2
20030222 (Red Hat Linux 3.2.2-5)
(1 row)

So what gives?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Simon Riggs 2005-07-26 19:54:21 Re: [Bizgres-general] Hardware suggestions for a new data
Previous Message DracKewl 2005-07-26 18:54:11 Select Stament Issue??