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) ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html