List:General Discussion« Previous MessageNext Message »
From:Keith Ivey Date:February 17 2005 5:57pm
Subject:Re: What is the max length of IN() function?
View as plain text  
Donny Simonton wrote:

> In our case we were using words, and phrases, so we would have something
> like:
> 
> IN ('a', 'apple', 'apple car', 'car', 'c')  etc...
> 
> We found that once it hits about 200 or so entries the query went from 0.00
> seconds to about 2-3 seconds.  Sometimes much more.

I would guess that it has more to do with the amount of your key 
space that the list ranges over than with the absolute number of 
entries.  Try comparing "IN ('a', 'z')" (or something similar) 
with "IN ('a', 'aa', 'aaa', 'aab', [...], 'aaaaaaaz')" (with 
lots of entries, all between 'a' and 'ab', or another small 
range).  MySQL can use a range of the index for the second, even 
though there are lots of entries, but not for the first, which 
may force it to scan the whole index.


-- 
Keith Ivey <keith@stripped>
Smokefree DC
http://www.smokefreedc.org
Washington, DC
Thread
What is the max length of IN() function?Daevid Vincent17 Feb
RE: What is the max length of IN() function?Tom Crimmins17 Feb
  • RE: What is the max length of IN() function?Donny Simonton17 Feb
    • Re: What is the max length of IN() function?Keith Ivey17 Feb