From 00c0a55c4b75ed97d85eafc9740dfba160321f15 Mon Sep 17 00:00:00 2001 From: Anthony Bedford Date: Wed, 21 Oct 2009 13:06:40 +0000 Subject: [PATCH] Added a section on buffered and unbuffered result sets. Fixed a few minor errors. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@289830 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mysqlnd/stats.xml | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/reference/mysqlnd/stats.xml b/reference/mysqlnd/stats.xml index fe65fdc123..4f332a4b14 100644 --- a/reference/mysqlnd/stats.xml +++ b/reference/mysqlnd/stats.xml @@ -104,6 +104,35 @@ php.ini settings related to the Zval cache, resulting in better performance. + + Buffered and Unbuffered Result Sets + + + Result sets can be buffered or unbuffered. Using default settings, + ext/mysql and ext/mysqli work + with buffered result sets for normal (non prepared statement) queries. + Buffered result sets are cached on the client. After the query + execution all results are fetched from the MySQL Server and stored in + a cache on the client. The big advantage of buffered result sets is + that they allow the server to free all resources allocated to a result + set, once the results have been fetched by the client. + + + Unbuffered result sets on the other hand are kept much longer on the + server. If you want to reduce memory consumption on the client, but + increase load on the server, use unbuffered results. If you experience + a high server load and the figures for unbuffered result sets are + high, you should consider moving the load to the clients. Clients + typically scale better than servers. Load does not only + refer to memory buffers - the server also needs to keep other + resources open, for example file handles and threads, before a result + set can be freed. + + + Prepared Statements use unbuffered result sets by default. However, + you can use mysqli_stmt_store_result to enable + buffered result sets. + Statistics returned by MySQL Native Driver @@ -111,7 +140,7 @@ The following tables show a list of statistics returned by the mysqli_get_client_stats, - mysqli_get_connections_stats and + mysqli_get_connection_stats and mysqli_get_cache_stats functions. @@ -564,9 +593,9 @@ the number of fetched buffered rows it can mean that the client application runs queries that cause larger result sets than needed resulting in rows not read by the client. - Examples of queries that will buffere results: + Examples of queries that will buffer results: mysqli_query, - mysqli_store_results + mysqli_store_result rows_fetched_from_client_normal_buffered,