On 1/26/2012 9:28 AM, Stephen Russell wrote: <snipped> >>> UPDATE MyTable SET MyFactor = 1.23456 WHERE Field1 = 'VALUE' AND Field2 >>> IN ("VALUE2","VALUE3") >>> >>> The EXPLAIN says it won't use the combined index. But for simpler >>> UPDATEs where it's just one value for Field2 and using an =, it says it >>> WILL use the index. For example, this SQL would utilize the compound >>> index: >>> >>> UPDATE MyTable SET MyFactor = 1.23456 WHERE Field1 = 'VALUE' AND Field2 >>> = "VALUE2" > --------------------------------- > > Would it be better to to run separate updates? > UPDATE MyTable SET MyFactor = 1.23456 WHERE Field1 = 'VALUE' > AND Field2 = "VALUE2" ,"VALUE3" > > UPDATE MyTable SET MyFactor = 1.23456 WHERE Field1 = 'VALUE' > AND Field2 = "VALUE3" > > I read in your first url that the size of the param may be your biggest issue.
I thought the same thing, Steve. Perhaps better to run separate updates for the 2 and 3 values for the FIELD2 multiple scenario. The math person inside of me says "Better to pass the data once (reminds me of "Big O notation" learned in college days), but indexes change that plan I suppose. -- Mike Babcock, MCP MB Software Solutions, LLC President, Chief Software Architect http://mbsoftwaresolutions.com http://fabmate.com http://twitter.com/mbabcock16 _______________________________________________ Post Messages to: ProFox@leafe.com 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/profox/4f217593.4040...@mbsoftwaresolutions.com ** 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.