Author: paul
Date: 2007-04-04 17:18:28 +0200 (Wed, 04 Apr 2007)
New Revision: 5734
Log:
r18669@frost: paul | 2007-04-04 10:16:51 -0500
Prepared statements can use the query cache now, sometimes. (Bug#735)
Modified:
trunk/refman-5.1/apis-c.xml
trunk/refman-5.1/dba-core.xml
trunk/refman-5.1/news-5.1.xml
trunk/refman-5.1/sql-syntax.xml
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:22867
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:18659
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:14593
+ 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:22867
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:18669
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:14593
Modified: trunk/refman-5.1/apis-c.xml
===================================================================
--- trunk/refman-5.1/apis-c.xml 2007-04-04 13:59:00 UTC (rev 5733)
+++ trunk/refman-5.1/apis-c.xml 2007-04-04 15:18:28 UTC (rev 5734)
Changed blocks: 1, Lines Added: 3, Lines Deleted: 3; 724 bytes
@@ -12359,9 +12359,9 @@
<listitem>
<para>
- <emphasis>Prepared statements do not use the query cache, even
- in cases where a query does not contain any
- placeholders</emphasis>. See
+ Before MySQL 5.1.17, prepared statements do not use the query
+ cache. As of 5.1.17, prepared statements use the query cache
+ under the conditions described in
<xref linkend="query-cache-how"/>.
</para>
</listitem>
Modified: trunk/refman-5.1/dba-core.xml
===================================================================
--- trunk/refman-5.1/dba-core.xml 2007-04-04 13:59:00 UTC (rev 5733)
+++ trunk/refman-5.1/dba-core.xml 2007-04-04 15:18:28 UTC (rev 5734)
Changed blocks: 2, Lines Added: 60, Lines Deleted: 6; 3412 bytes
@@ -30659,22 +30659,23 @@
different queries and are cached separately.
</para>
+<!-- commenting this out until I figure out how to revise the
+"before parsing" part, which is not true for prepared statements.
<para>
Because comparison of a query against those in the cache occurs
before parsing, the cache is not used for queries of the
following types:
</para>
+-->
+ <para>
+ The cache is not used for queries of the following types:
+ </para>
+
<itemizedlist>
<listitem>
<para>
- Prepared statements
- </para>
- </listitem>
-
- <listitem>
- <para>
Queries that are a subquery of an outer query
</para>
</listitem>
@@ -30735,6 +30736,59 @@
</para>
<para>
+ Before MySQL 5.1.17, prepared statements do not use the query
+ cache. As of 5.1.17, prepared statements use the query cache
+ under certain conditions, which differ depending on the
+ preparation method:
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ Statements that are issued via the binary protocol using
+ <literal>mysql_stmt_prepare()</literal> and
+ <literal>mysql_stmt_execute()</literal>. See
+ <xref linkend="c-api-prepared-statements"/>.
+ </para>
+
+ <para>
+ For a prepared statement executed via the binary protocol,
+ comparison with statements in the query cache is based on
+ the text of the statement after expansion of
+ <literal>?</literal> parameter markers. The statement is
+ compared only with other cached statements that were
+ executed via the binary protocol. That is, for query cache
+ purposes, statements issued via the binary protocol are
+ distinct from statements issued via the text protocol.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Statements that are issued via the text (non-binary)
+ protocol using <literal>PREPARE</literal> and
+ <literal>EXECUTE</literal>. See <xref linkend="sqlps"/>.
+ These are denoted SQL PS statements here.
+ </para>
+
+ <para>
+ For a prepared statement executed via
+ <literal>PREPARE</literal> and <literal>EXECUTE</literal>,
+ it is not cached if it contains any <literal>?</literal>
+ parameter markers. In that case, the statement after
+ parameter expansion contains references to user variables,
+ which prevents caching, even for non-prepared statements. If
+ the statement contains no parameter markers, the statement
+ is compared with statements in the query cache that were
+ executed via the text protocol (that is, it is compared with
+ other SQL PS statements and non-prepared statements).
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
A query cannot be cached if it contains any of the functions
shown in the following table:
</para>
Modified: trunk/refman-5.1/news-5.1.xml
===================================================================
--- trunk/refman-5.1/news-5.1.xml 2007-04-04 13:59:00 UTC (rev 5733)
+++ trunk/refman-5.1/news-5.1.xml 2007-04-04 15:18:28 UTC (rev 5734)
Changed blocks: 1, Lines Added: 8, Lines Deleted: 0; 713 bytes
@@ -522,6 +522,14 @@
<listitem>
<para>
+ Prepared statements now use the query cache under the
+ conditions described in <xref linkend="query-cache-how"/>.
+ (Bug #735)
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
Added the <option>--secure-file-priv</option> option for
<command>mysql-test-run.pl</command>, which limits the effect
of the <literal>load_file</literal> command for
Modified: trunk/refman-5.1/sql-syntax.xml
===================================================================
--- trunk/refman-5.1/sql-syntax.xml 2007-04-04 13:59:00 UTC (rev 5733)
+++ trunk/refman-5.1/sql-syntax.xml 2007-04-04 15:18:28 UTC (rev 5734)
Changed blocks: 1, Lines Added: 6, Lines Deleted: 0; 563 bytes
@@ -25288,6 +25288,12 @@
characters).
</para>
+ <para>
+ Before MySQL 5.1.17, prepared statements do not use the query
+ cache. As of 5.1.17, prepared statements use the query cache under
+ the conditions described in <xref linkend="query-cache-how"/>.
+ </para>
+
</section>
</chapter>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r5734 - in trunk: . refman-5.1 | paul | 4 Apr |