MySQL IN condition limit

xpepermint picture xpepermint · Nov 25, 2010 · Viewed 58.5k times · Source

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?

Answer

Progman picture Progman · Nov 25, 2010

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.