MySQL number of items within "in clause"
From the manual:
The number of values in the IN
list is only limited by the max_allowed_packet
value.
Starting from a certain number, the IN
tables are faster.
MySQL
has something inside its code that makes building a range over a large number of constant values slower than doing the same in a nested loop.
See this article in my blog for performance details:
- Passing parameters in MySQL: IN list vs. temporary table