If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > max no. of values in WHERE ... IN clause

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-13-04, 05:09
mihai mihai is offline
Registered User
 
Join Date: Sep 2004
Posts: 5
max no. of values in WHERE ... IN clause

Hi all,

can anyone tell mey what the maximum number of values (if there is any) which can be used in the WHERE ... IN clause?

ex:
.... WHERE ID IN (1, 2, 3 ... , n) ....
what is the maximum number of values which I can put between paranthesis?

10x in advance
mihai.
Reply With Quote
  #2 (permalink)  
Old 09-13-04, 08:24
RBARAER RBARAER is offline
Registered User
 
Join Date: Aug 2004
Location: France
Posts: 754
Hello,

According to the MySQL manual, "The number of values in the IN list is only limited by the max_allowed_packet value" (http://dev.mysql.com/doc/mysql/en/Co...Operators.html). And a search on "max_allowed_packet" on this page told : "The default value of max_allowed_packet is now 64KB for the server and 512KB for the client", speaking of version 3.20.17. I also found, in order to explain this limit : "All string functions now return NULL if the returned string should be longer than max_allowed_packet bytes" (3.21.12). I'm not sure it's the same in v4, but it seems like you can put A LOT of values in your IN condition, though only a limited number.

Regards,

RBARAER
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On