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
This commit is contained in:
Anthony Bedford 2009-10-21 13:06:40 +00:00
parent 3e0662f976
commit 00c0a55c4b

View file

@ -104,6 +104,35 @@
<filename>php.ini</filename> settings related to the Zval cache,
resulting in better performance.
</para>
<para>
<emphasis role="bold">Buffered and Unbuffered Result Sets</emphasis>
</para>
<para>
Result sets can be buffered or unbuffered. Using default settings,
<literal>ext/mysql</literal> and <literal>ext/mysqli</literal> 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.
</para>
<para>
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. <quote>Load</quote> 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.
</para>
<para>
Prepared Statements use unbuffered result sets by default. However,
you can use <function>mysqli_stmt_store_result</function> to enable
buffered result sets.
</para>
<para>
<emphasis role="bold">Statistics returned by MySQL Native
Driver</emphasis>
@ -111,7 +140,7 @@
<para>
The following tables show a list of statistics returned by the
<function>mysqli_get_client_stats</function>,
<function>mysqli_get_connections_stats</function> and
<function>mysqli_get_connection_stats</function> and
<function>mysqli_get_cache_stats</function> functions.
</para>
<para>
@ -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.</entry>
<entry>Examples of queries that will buffere results:
<entry>Examples of queries that will buffer results:
<function>mysqli_query</function>,
<function>mysqli_store_results</function></entry>
<function>mysqli_store_result</function></entry>
</row>
<row>
<entry><literal>rows_fetched_from_client_normal_buffered</literal>,