Is there an additional AND AND columnname `LIKE '%' 'that degrades performance?


simple question: does something like this query add to performance in mysql or speed up its optimization?

AND `name` LIKE '%'

I do not have a large database so I can test it.

By the way, I want this because I want users to be able to send some parameters to my server side script, which then captures the prepared statement specified by the user and inserts the parameters. I want users to be able to omit parameters when searching without sacrificing performance, and LIKEusually relatively slow, right?

+3
source share
5 answers

LIKE , , name. ?

EXPLAIN [EXTENDED] SELECT [...] AND `name` LIKE '%'

. http://dev.mysql.com/doc/refman/5.0/en/explain.html

MySQL , LIKE .

+4

. . , , .

0

LIKE . , . ?

, , LIKE , , , .

0

: LIKE . , LIKE.

OR .

, LIKE VARCHAR .

0

MySQL 5 MyISAM.

SELECT * FROM tablename

17596 rows in set (0.28 sec)

SELECT * FROM tablename WHERE columnname LIKE '%'

17596 rows in set (0.20 sec)

, MySQL , '0' = '0' LIKE '%'.

-1

Source: https://habr.com/ru/post/1781296/


All Articles