LIKE and INDEX
От
Jie Liang
Тема
LIKE and INDEX
Дата
Msg-id
E7E213858379814A9AE48CA6754F5ECB36335D@mail01.stbernard.com
Список
Дерево обсуждения
LIKE and INDEX "Jie Liang" <jie@stbernard.com>
Re: LIKE and INDEX Rod Taylor <pg@rbt.ca>
Re: LIKE and INDEX Richard Huxton <dev@archonet.com>
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 по дате отправления