理論上 SELECT LIKE 'xxxx%' 應該可以用 INDEX search,結果沒有,不知道為什麼?
難道與 PRIMARY KEY 有關?還是 bug ?
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)