我可以传递给 MySQL where 子句的参数数量是否有限制?

Is there a limit on how many arguments I can pass to MySQL where clause?

我们需要构建一个包含很多条件的 Mysql 查询:

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

我知道我可以改用 IN 但我很好奇我们可以传递给 MySQL 中的 WHERE 子句的参数数量是否有任何限制?

是的,您可以使用以下参数找到尺寸: max_allowed_packet

据我所知没有具体限制条件的数量,但实际上查询长度是有限制的。

参见:What is maximum query size for mysql?