> I think more exactly, the planner can't possibly know how to plan an
> indexscan with a leading '%', because it has nowhere to start.
The fact is that index scan is performed on LIKE expression on a string not
preceded by '%', except when bound parameter is used.
select * from table where field like 'THE NAME%'; -- index scan
select * from table where field like '%THE NAME%'; -- seq scan
select * from table where field like :bind_param; -- seq scan (always)
In response to
pgsql-hackers by date
|Next:||From: Dave||Date: 2006-05-26 00:23:53|
|Subject: Creating a case insensitive data type|
|Previous:||From: Tom Lane||Date: 2006-05-25 22:16:14|
|Subject: Re: XLogArchivingActive |