mysql - 'LIKE' or 'NOT LIKE' that is the question -


i'm wondering if there particular performance advantage in using like on not like or vice versa. example:

say have 1000 rows (yes not many, after example) , 50 have word world in hello column after querying db using

select id table hello like'%world%' 

or

select id table hello not '%world%' 

like returns 50 while using not like returns 950 question not on should use in particular scenario rather if there performance cost use both have 'search' entire table anyway :)

there no performance difference. not inverts result of whatever follows it. logical inversion extremely quick operation, taking few nanoseconds on modern processor....

all of expense related number of rows selected, , tracking them other parts of query.


Comments