LIKE and INDEX - Mailing list pgsql-performance

From Jie Liang
Subject LIKE and INDEX
Date
Msg-id E7E213858379814A9AE48CA6754F5ECB36335D@mail01.stbernard.com
Whole thread Raw
Responses Re: LIKE and INDEX
Re: LIKE and INDEX
List pgsql-performance
All,
This is old topic, when I use:
select url from urlinfo where url like 'http://www.lycos.de%';
it uses the index, good!

but if I use:
select url from urlinfo where url like 'http://%.lycos.de';
it won't use index at all, NOT good!
is there any way I can force secon query use index???

Thanks.

Jie Liang

                                           QUERY PLAN
------------------------------------------------------------------------------------------------
 Index Scan using urlinfo_ukey on urlinfo  (cost=0.00..6.01 rows=1 width=33)
   Index Cond: ((url >= 'http://www.lycos.de/'::text) AND (url < 'http://www.lycos.de0'::text))
   Filter: (url ~ '^http://www\\.lycos\\.de/.*$'::text)
(3 rows)

                         QUERY PLAN
-------------------------------------------------------------
 Seq Scan on urlinfo  (cost=0.00..100440.48 rows=4 width=33)
   Filter: (url ~ '^http://.*\\.lycos\\.de$'::text)
(2 rows)

pgsql-performance by date:

Previous
From: Pailloncy Jean-Gérard
Date:
Subject: Re: INSERT RULE
Next
From: Bruce Momjian
Date:
Subject: Re: History of oids in postgres?