Or, if anyone really cares, just write both the queries, fire up the Query Profiler (for MSSQL) and see what the execution plans say.
On Wed, Sep 8, 2010 at 12:12 PM, Michael Grant <mgr...@modus.bz> wrote: > > Hmmm. That seems to conflict with what Steven says. Perhaps a blood match is > in order? > > > On Wed, Sep 8, 2010 at 3:10 PM, Mike Chabot <mcha...@gmail.com> wrote: > >> >> 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:336916 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm