请问tidb 最大sql语句长度有没有限制?

mysql中 ,in语句中参数个数是不限制的。不过对整段sql语句的长度有了限制
官方解释看这 https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_allowed_packet
报文大小限制默认4M。

在tidb的代码中也有类似的限制:

// Run reads client query and writes query result to client in for loop, if there is a panic during query handling,
// it will be recovered and log the panic error.
// This function returns and the connection is closed if there is an IO error or there is a panic.
func (cc *clientConn) Run(ctx context.Context) {
	const size = 4096

https://github.com/pingcap/tidb/blob/feee7c258ac7799499f561d281434b243c4fc92e/server/conn.go#L1022

6 个赞