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

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -