2

we need to construct a Mysql query with lots of conditions:

where userId=useIdi1 or userId=userId2 or userId=userId3....

I know I can use IN instead but just curious if there is any limit on how many parameters(arguments) we can pass to WHERE clause in MySQL?

EstevaoLuis
  • 2,422
  • 7
  • 33
  • 40
user468587
  • 4,799
  • 24
  • 67
  • 124

2 Answers2

4

Yes, you can find the size with the parameter: max_allowed_packet

4

As far as I know there is no limit specifically to the number of conditions, but in practice there is a limit to query length.

See: What is maximum query size for mysql?

Community
  • 1
  • 1
Uueerdo
  • 15,723
  • 1
  • 16
  • 21