gpt4 book ai didi

php - 多查询中的最大查询数是多少?

转载 作者:行者123 更新时间:2023-11-29 01:04:08 25 4
gpt4 key购买 nike

使用 php 运行多查询时是否有最大查询数?

  $conn = new mysqli($db_hostname, $db_username, $db_password);
if (mysqli_connect_errno()) {
exit('Connect failed: '. mysqli_connect_error());
}

$sql = "CREATE TABLE IF NOT EXISTS......";
$sql .= "CREATE TABLE IF NOT EXISTS......";
$sql .= "CREATE TABLE IF NOT EXISTS......";
$sql .= "INSERT ......";
$sql .= "INSERT ......";
<and so on>
mysqli_autocommit($conn, false);
mysqli_multi_query($conn, $sql);
mysqli_rollback($conn);

最佳答案

我现在不知道 PHP 函数是否 mysqli_multi_query是通过使用 MySQL API 的多查询可能性实现的或者如果这会在 PHP 端拆分语句。

但您可以尝试在您的 my.cnf 中提高 net_buffer_length butmax_allowed_pa​​cket。但我的印象是这些是每个语句缓冲区。

对于在这里绊倒的人要清楚,不是像 OP 那样出于好奇,而是因为他们碰到了最大值:通常有 other waysmany INSERTs .

关于php - 多查询中的最大查询数是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12798896/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com