SELECT LIKE 'xxx%' doesn't use index scan - Mailing list pgsql-bugs

From dhliu
Subject SELECT LIKE 'xxx%' doesn't use index scan
Date
Msg-id 47689234.8010507@msa.hinet.net
Whole thread Raw
Responses Re: SELECT LIKE 'xxx%' doesn't use index scan
List pgsql-bugs
db =# explain SELECT seq FROM tab WHERE str like 'edt%';
QUERY PLAN
-----------------------------------------------------------
Seq Scan on tab (cost=0.00..6465.55 rows=1 width=4)
Filter: (str ~~ 'edt%'::text)
(2 rows)

db=# explain SELECT seq FROM tab WHERE str = 'edta';
QUERY PLAN
------------------------------------------------------------------------------
Index Scan using tab_pkey on tab (cost=0.00..8.30 rows=1 width=4)
Index Cond: (str = 'edta'::text)
(2 rows)



PostgreSQL 8.2.5 on i586-mandriva-linux-gnu, compiled by GCC
i586-mandriva-linux-gnu-gcc (GCC) 4.2.2 20070909 (prerelease)
(4.2.2-0.RC.1mdv2008.0)


Thank you.


Edward Liu

pgsql-bugs by date:

Previous
From: iuri de araujo sampaio
Date:
Subject: Re: ltree installation error
Next
From: "Boonchai"
Date:
Subject: BUG #3829: Wrong index reporting from pgAdmin III (v1.8.0 rev 6766-6767)