Go prepare statment超过mysql最大数

本文介绍了MySQL中max_prepared_stmt_count参数的作用及调整方法。该参数限制了所有会话中预备语句的数量,默认值为16382。当超过此限制时,将触发错误1461。通过调整max_prepared_stmt_count可以解决此问题。

mysql_stmt_prepare failed! error(1461)Can't create more than max_prepared_stmt_count statements (current value: 16382)



给出的回复如下:

max_prepared_stmt_count参数限制了同一时间在mysqld上所有session中prepared 语句的上限。
它的取值范围为“0 - 1048576”,默认为16382。
mysql对于超出max_prepared_stmt_count的prepare语句就会报1461的错误。
 
调试语句:

mysql> show global status like '%stmt%';

+----------------------------+--------+

| Variable_name              | Value  |

+----------------------------+--------+

| Binlog_stmt_cache_disk_use | 0      |

| Binlog_stmt_cache_use      | 0      |

| Com_stmt_close             | 142593 |

| Com_stmt_execute           | 170302 |

| Com_stmt_fetch             | 0      |

| Com_stmt_prepare           | 157761 |

| Com_stmt_reprepare         | 0      |

| Com_stmt_reset             | 0      |

| Com_stmt_send_long_data    | 0      |

| Prepared_stmt_count        | 4      |

+----------------------------+--------+

10 rows in set (0.06 sec)

mysql> set global max_prepared_stmt_count=124000;
Query OK, 0 rows affected (0.00 sec)

 

转载于:https://www.cnblogs.com/studyNT/p/5060624.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值