Mysql performance with LIKE '%%' -
for given query,
select * contacts name "%$name%"
does mysql optimises query exclude condition when variable $name
empty?
when $name empty string, query executed as
select * contacts
or
select * contacts name "%%"
as alex k mentioned in comments, mysql won't optimise query.
in case have null values in rows, query not return rows in result set, explains there check on each row. suggested, best have check on code , skip clause if search value empty.
Comments
Post a Comment