Well, I have to apologize! I am going through some training right now that is telling me exactly that.
I was always told before that using like was bad, but apparently it is better. Steve -----Original Message----- From: Mike Chabot [mailto:mcha...@gmail.com] Sent: Wednesday, September 08, 2010 3:10 PM To: cf-talk Subject: Re: WHERE Left(str,5) = 'string' VS WHERE str LIKE 'string%' In SQL Server go with "like str%." The reason is that like str% is sargable and functions are not. Functions also have overhead that native set-based SQL does not. I would assume the same is true with mySQL. Native SQL is usually faster than functions as a general rule, unless the equivalent SQL is wildly complex relative to what the function is doing for you. -Mike Chabot On Wed, Sep 8, 2010 at 1:27 PM, Michael Grant <mgr...@modus.bz> wrote: > > What about mySQL? > > Do you know if this is documented and easy to find? > > > > On Wed, Sep 8, 2010 at 1:23 PM, DURETTE, STEVEN J (ATTASIAIT) < > sd1...@att.com> wrote: > >> >> With SQL Server, DEFINITELY go with left(str, 4) = 'string' >> >> It has much less processing overhead. >> >> -----Original Message----- >> From: Michael Grant [mailto:mgr...@modus.bz] >> Sent: Wednesday, September 08, 2010 1:20 PM >> To: cf-talk >> Subject: WHERE Left(str,5) = 'string' VS WHERE str LIKE 'string%' >> >> >> Any advantage to one over the other? >> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336915 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm