开发者

Are mysqli_multi_query php function connect 1 time to db or each query?

开发者 https://www.devze.com 2022-12-10 10:25 出处:网络
Just wonder if the function mysqli_multi_query connect just 1 time开发者_如何学Python to the database or each query?Yes because it uses $link as connection id

Just wonder if the function mysqli_multi_query connect just 1 time开发者_如何学Python to the database or each query?


Yes because it uses $link as connection id http://php.net/manual/en/mysqli.multi-query.php

And it doesn't actually connect - it only uses already established connection.


mysqli_multiple_query is more faster then normal query.
A small benchmark:

for ($i=0; $i<1000; $i++) { 
    // 3 queries, each one searching different tables over 1.000.000 records.
};

Results:

mysqli_query: 15.46s
mysqli_multi_query: 13.40s

0

精彩评论

暂无评论...
验证码 换一张
取 消