Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2004
    Posts
    5

    Unanswered: 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.

  2. #2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •