Re: LIKE not using indexes (due to locale issue?)

From: Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
To: Klint Gore <kgore4(at)une(dot)edu(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: LIKE not using indexes (due to locale issue?)
Date: 2008-06-25 06:15:26
Message-ID: 1214374527.9173.3.camel@neuromancer.home.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2008-06-25 at 14:58 +1000, Klint Gore wrote:
> Ow Mun Heng wrote:
> > explain select * from d_trr where revision like '^B2.%.SX'
> > --where ast_revision = 'B2.M.SX'
> >
> > Seq Scan on d_trr (cost=0.00..2268460.98 rows=1 width=16)
> > Filter: ((revision)::text ~~ '^B2.%.SX'::text)
> >
> > show lc_collate;
> > en_US.UTF-8
> >
> > Is it that this is handled by tsearch2? Or I need to do the locale to
> > "C" for this to function?
> >
> See http://www.postgresql.org/docs/8.3/interactive/indexes-opclass.html.
> It tells you how to create an index that like might use in non-C locales.

Just more information. This columns is created with the varchar type.

original index is created using

CREATE INDEX idx_d_ast
ON xmms.d_trh
USING btree
(revision varchar_pattern_ops);

CREATE INDEX idx_d_ast2
ON xmms.d_trh
USING btree
(revision);

after creating it, seems like it is still doing the seq_scan.
So what gives? Can I get more clues here?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew 2008-06-25 06:18:58 Full Text Search - i18n
Previous Message Klint Gore 2008-06-25 04:58:30 Re: LIKE not using indexes (due to locale issue?)