LIKE and INDEX
От | Jie Liang |
---|---|
Тема | LIKE and INDEX |
Дата | |
Msg-id | E7E213858379814A9AE48CA6754F5ECB36335D@mail01.stbernard.com обсуждение исходный текст |
Ответы |
Re: LIKE and INDEX
Re: LIKE and INDEX |
Список | 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 по дате отправления: