[lug] OT - MySQL IN() limit

John Starkey jstarkey at breezedev.com
Tue Sep 8 09:43:41 MDT 2009


Jason Vallery wrote:
> You might want to consider a UNION instead of an IN if you have a 
> large number of parameters.  The IN clause is very expensive 
> computationally so your query will probably be poorly performing. 
>
> As to your original question, I've never experienced the upper limit.  
> I typically hit the upper limit of the max_allowed_packet size much 
> earlier than I do any hard query limits.
>
> -JV
Thanks Jason. This is for an update though, not a select. It's some code 
I took over, changing it to an IN statement from a while-loop-update 
brought the processing time down from 7 minutes to 1. The client is 
happy. :)

I'll look into the max_allowed_packet right away though. Thanks for that 
info.

John

-- 
-----------------
John Starkey
720-227-0516
I just know I'm a better manager when I have Joe DiMaggio in center field. --Casey Stengel
-----------------




More information about the LUG mailing list