Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL IN condition limit

Hey, I have to use IN condition in my MySQL statement with a large set of ids.

Example

SELECT * FROM users WHERE id IN (1,2,3,4...100000) 

Is there a limit if items the IN statement can have?

like image 346
xpepermint Avatar asked Nov 25 '10 09:11

xpepermint


People also ask

How many values I can pass to in clause in MySQL?

From my experience the maximum values is 1000 values in clause IN ('1',....,'1000') , I have 1300 value in my excel sheet,I put them all into IN ,MySQL return only 1000 .

What does LIMIT 1 1 do in SQL?

The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be nonnegative integer constants (except when using prepared statements).

What is LIMIT 2 1 SQL query?

The LIMIT clause is used in the SELECT statement to constrain the number of rows in a result set. The LIMIT clause accepts one or two arguments. The values of both arguments must be zero or positive integer constants.


1 Answers

No there isn't, check the manual about the IN function:

The number of values in the IN list is only limited by the max_allowed_packet value.

like image 133
Progman Avatar answered Oct 18 '22 21:10

Progman