AFAIK Limit is applied last, just as you said. Explain is more for determining what indexes (or lack thereof) a certain query is using.
Glad to hear I'll have at least 1 attendee! :) At 12:59 PM 5/3/2007, Kevin Cully wrote: >I would think that it would be faster doing one SPT to MySQL than to do >multiple hits. I'm trying to remember but I believe that the LIMIT is >done last, after the select so it really isn't a performance booster >that you might think. > >I think between using EXPLAIN, and doing some sample tests, that the >best methodology will present itself. > >I'm definitely going to sit in on Steve Ellenoff's MySQL session at >FoxForward. There's lots for me to learn, to be sure. > >-Kevin >CULLY Technologies, LLC > >Sponsor of FoxForward 2007 >foxforward.net > > >MB Software Solutions wrote: > > Here's my built lcSQL string: > > > > lcSQL = [update addresses set iactive = 0 where iacctid = ] > > + ALLTRIM(STR(toRecord.iacctid)) + [ and caddrtype = '] + ; > > ALLTRIM(toRecord.cAddrType) + [' and iactive = 1] > > > > > > Question: rather than just blindly run this, would it be better > > performancewise I wonder if I should do a SELECT first to see if any > > such records exist prior to calling the update sql? Example (after > > dynamically built): > > > > select iid from addresses where iacctid = '1234' and caddrtype = 'S' > > and iactive = 1 LIMIT 1 > > > > This query would tell me if a data condition exists that requires the > > UPDATE sql. Otherwise, the UPDATE sql is not needed. > > > > I mean, if no records exist, what's the point (even though my WHERE > > clause clearly states the condition). I'm trying to hit the database > > the LEAST number of times and thinking that the SELECT with the LIMIT 1 > > clause may save me cycles/trips as opposed to just letting the UPDATE > > sql go through the entire table (well, perhaps not the entire table > > since it's indexed on iacctid). > > > > Is this much to do about nothing? <g> > > > > > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/%(messageid)s ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

