Re: wildcard search performance with "like" - Mailing list pgsql-performance

From Tom Lane
Subject Re: wildcard search performance with "like"
Date
Msg-id 21504.1137531693@sss.pgh.pa.us
Whole thread Raw
In response to wildcard search performance with "like"  (Yantao Shi <y.shi@larc.nasa.gov>)
List pgsql-performance
Yantao Shi <y.shi@larc.nasa.gov> writes:
> testdbspc=# explain select file_name from catalog where file_name like
> 'MOD04_L2.A2005311.%.004.2005312013%.hdf';
> QUERY PLAN
> Seq Scan on catalog  (cost=0.00..429.00 rows=1 width=404)
>   Filter: (file_name ~~ 'MOD04_L2.A2005311.%.004.2005312013%.hdf'::text)
> (2 rows)

I'm betting you are using a non-C locale.  You need either to run the
database in C locale, or to create a special index type that is
compatible with LIKE searches.  See
http://www.postgresql.org/docs/8.1/static/indexes-opclass.html

            regards, tom lane

pgsql-performance by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: Suspending SELECTs
Next
From: Josh Berkus
Date:
Subject: Re: sum of left join greater than its parts