In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "detailed explanation of Buffer usage of MySQL operation in PHP". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
There are three ways to connect php to mysql, mysql,mysqli,pdo. No matter which way you connect, there is a difference between using buffer and not using buffer.
What do you mean by using buffer and not using buffer?
The client and the mysql server perform query operations. If the amount of data obtained during the query operation is relatively large, where do you put the query results?
There are two places to put: the buffer on the client side and the buffer on the server side.
The buffer we are talking about here refers to the buffer of the client. If the query result has been obtained from the server and placed in the buffer of the client, we call it using buffer. If it is still stored in a buffer on the server side, we will say that buffer (unbuffer) is not used.
What's the difference between using buffer and not using buffer?
Mainly in terms of memory, using buffer will increase the memory pressure on the client, and when the returned data result is particularly large, it may take up a relatively large process on the calling client (actually a php process). Not using buffer naturally puts more pressure on the server (in this case, the server that provides mysql services).
Specific reference: php query mysql memory footprint analysis of a large number of data
How do the three modes in php set whether or not to use buffer?
The default query of mysql uses buffer, while mysql_unbuffer_query is required if you don't use buffer
The default query of mysqli does not use buffer. To use buffer, you need to set mysqli_store_result.
The default quey of pdo does not use buffer. To use buffer, you need to set mysql_attr_use_buffered_query.
The related codes are as follows:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 218
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.