1. Is LIKE acceptable for fields which are varchar? I'm hoping that for those fields it's not considered too bad to have to use it.
2. Does it matter what order thigns are in for the "WHERE" clause? If I put WHERE id='{$id}' and something LIKE '%something%'
would it be faster by having like on the right side or does it still not omit rows based upon the first one first anyway?
Yeah I have little knowledge of basics. lol
Also I am guessing I probably should add an index that would combine both of those fields maybe?
MySQL: LIKE
Started by BASHERS33, Apr 22 2009 05:32 AM
3 replies to this topic
#1
Posted 22 April 2009 - 05:32 AM
|
|
|
#2
Guest_Jordan_*
Posted 22 April 2009 - 06:45 AM
Guest_Jordan_*
1) You can do it and I've never heard of anything wrong with it. You may want to index that field though.
2) I don't think the order has any effect on the amount of execution time or resources consumed.
2) I don't think the order has any effect on the amount of execution time or resources consumed.
#3
Posted 22 April 2009 - 06:50 AM
ok, thanks. I had just talked to my mom also who used to eb a programmer and DBA and she said also that she saw LLIKE used often and didn't see a problem.
The reason I was wondering is because a programmer for Invision had mentioned how bad it would be if they had to run the queries using MATCH AGAINST on each page of search results. So I figured it may be that things such as LIKE or MATCH AGAINST are slow or resource intensive.
I also thought someone told me that LIKE is not used with all database drivers, but if it is used with what my mom used (DB2) and what I sue (MySQL) I am wondering if it is rerally widely used. Maybe MATCH AGAINST is the one which is only in mysql?
The way I always understood it was that match against was used for text fields and like was used for small fields.
The reason I was wondering is because a programmer for Invision had mentioned how bad it would be if they had to run the queries using MATCH AGAINST on each page of search results. So I figured it may be that things such as LIKE or MATCH AGAINST are slow or resource intensive.
I also thought someone told me that LIKE is not used with all database drivers, but if it is used with what my mom used (DB2) and what I sue (MySQL) I am wondering if it is rerally widely used. Maybe MATCH AGAINST is the one which is only in mysql?
The way I always understood it was that match against was used for text fields and like was used for small fields.
#4
Posted 22 April 2009 - 08:55 AM
I can Believe that match against would eat more power, as it normally searches through more fields. I still see no reason to why not use them when you need to.
although, I think like would be easier on the computer, as it only matches to a string instead of several fields.
although, I think like would be easier on the computer, as it only matches to a string instead of several fields.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall


Sign In
Create Account


Back to top









