I executed the LIKE clause SQL twice as below.
My table has 50000 rows and the first SQL returns 50000 rows.
On the other hand, the second SQL returns 0 rows.
I thought that in both cases MySQL had to examine all 50000 rows to execute.
but Why is Query_time of the second SQL much faster than the first one?
Am I missing something?
Does Rows_sent influence Query_time?
If so, how does it affect?
# Query_time: 4.575865 Lock_time: 0.000120 Rows_sent: 50000 Rows_examined: 50000
SELECT * FROM `XXXX` WHERE `XXXX` LIKE "%Tom%";
# Query_time: 0.163456 Lock_time: 0.000128 Rows_sent: 0 Rows_examined: 50000
SELECT * FROM `XXXX` WHERE `XXXX` LIKE "%TTTTTTTTOOOOOOOOOOOMMMMMMMMM%";
I'm using Amazon Aurora MySQL3 (with MySQL 8.0 compatibility).
Thank you in advance.