Author: paul
Date: 2008-05-15 21:15:51 +0200 (Thu, 15 May 2008)
New Revision: 10750
Log:
r31436@frost: paul | 2008-05-15 14:14:49 -0500
Document --enable-profiling configuration option that enables statement
profiling.
Merge profiling info from 5.0 manual to 6.0 manual.
(Not present in 5.1 manual.)
Modified:
trunk/dynamic-docs/build-configure/buildoptions.xml
trunk/dynamic-docs/changelog/mysqld.xml
trunk/refman-5.0/installing-cs-core.xml
trunk/refman-5.1/optimization.xml
trunk/refman-6.0/information-schema.xml
trunk/refman-6.0/installing-core.xml
trunk/refman-6.0/optimization.xml
trunk/refman-6.0/sql-syntax.xml
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:35828
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:31434
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:31263
+ 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:35828
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:31436
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:31263
Modified: trunk/dynamic-docs/build-configure/buildoptions.xml
===================================================================
--- trunk/dynamic-docs/build-configure/buildoptions.xml 2008-05-15 18:26:50 UTC (rev 10749)
+++ trunk/dynamic-docs/build-configure/buildoptions.xml 2008-05-15 19:15:51 UTC (rev 10750)
Changed blocks: 2, Lines Added: 17, Lines Deleted: 1; 1015 bytes
@@ -1800,7 +1800,7 @@
<formatbase format="--without-uca">
- <description>Skip building of the national Unicode collations.</description>
+ <description>Skip building of the national Unicode collations</description>
</formatbase>
<versions>
@@ -1810,5 +1810,21 @@
</versions>
</buildoption>
+ <buildoption id="enable-profiling">
+ <formatbase format="--enable-profiling">
+
+ <description>Enable profiling</description>
+
+ </formatbase>
+ <versions>
+ <manual version="5.0"/>
+ <introduced version="5.0.37"/>
+ <!-- not for use in 5.1 -->
+ <manual version="6.0"/>
+ <introduced version="6.0.5"/>
+ </versions>
+
+ </buildoption>
+
</buildoptions>
Modified: trunk/dynamic-docs/changelog/mysqld.xml
===================================================================
--- trunk/dynamic-docs/changelog/mysqld.xml 2008-05-15 18:26:50 UTC (rev 10749)
+++ trunk/dynamic-docs/changelog/mysqld.xml 2008-05-15 19:15:51 UTC (rev 10750)
Changed blocks: 3, Lines Added: 12, Lines Deleted: 2; 1330 bytes
@@ -32475,8 +32475,10 @@
<versions>
<version ver="5.0.45"/>
+<!-- community feature not present in 5.1
<version ver="5.1.23-ndb-6.2.14"/>
<version ver="5.1.24"/>
+-->
<version ver="6.0.5"/>
</versions>
@@ -104245,12 +104247,14 @@
<versions>
<version ver="5.0.37"/>
<version ver="5.0.45"/>
+<!-- community feature not present in 5.1
<version ver="5.1.23-ndb-6.2.14"/>
<version ver="5.1.24"/>
+-->
<version ver="6.0.5"/>
</versions>
- <message ver="5.0.37">
+ <message ver="5.0.37,6.0.5">
<para>
Added the <literal>SHOW PROFILES</literal> and <literal>SHOW
@@ -104263,9 +104267,15 @@
<xref linkend="profiling-table"/>. (From Jeremy Cole)
</para>
+ <para>
+ The profiling feature is enabled via a new
+ <option>--enable-profiling</option> opion to
+ <command>configure</command>.
+ </para>
+
</message>
- <message>
+ <message ver="5.0.45">
<para>
Potential memory leaks in <literal>SHOW PROFILE</literal> were
Modified: trunk/refman-5.0/installing-cs-core.xml
===================================================================
--- trunk/refman-5.0/installing-cs-core.xml 2008-05-15 18:26:50 UTC (rev 10749)
+++ trunk/refman-5.0/installing-cs-core.xml 2008-05-15 19:15:51 UTC (rev 10750)
Changed blocks: 1, Lines Added: 20, Lines Deleted: 0; 1186 bytes
@@ -8887,6 +8887,26 @@
<listitem>
<para>
+ <indexterm>
+ <primary>configure</primary>
+ <secondary>enable-profiling option</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>enable-profiling option</primary>
+ <secondary>configure</secondary>
+ </indexterm>
+
+ In MySQL Community Server, this option enables the statement
+ profiling capability exposed by the <literal>SHOW
+ PROFILE</literal> and <literal>SHOW PROFILES</literal>
+ statements. (See <xref linkend="show-profiles"/>.) The
+ option was added in MySQL 5.0.37.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
See <xref linkend="operating-system-specific-notes"/>, for
options that pertain to particular operating systems.
</para>
Modified: trunk/refman-5.1/optimization.xml
===================================================================
--- trunk/refman-5.1/optimization.xml 2008-05-15 18:26:50 UTC (rev 10749)
+++ trunk/refman-5.1/optimization.xml 2008-05-15 19:15:51 UTC (rev 10750)
Changed blocks: 1, Lines Added: 0, Lines Deleted: 5; 627 bytes
@@ -12181,11 +12181,6 @@
must have the <literal>PROCESS</literal> privilege.
</para>
- <remark role="todo">
- The names are specific to SHOW PROCESSLIST and are not
- necessarily the same for SHOW PROFILE or I_S.PROCESSLIST.
- </remark>
-
<para>
Each process list entry contains several pieces of information:
</para>
Modified: trunk/refman-6.0/information-schema.xml
===================================================================
--- trunk/refman-6.0/information-schema.xml 2008-05-15 18:26:50 UTC (rev 10749)
+++ trunk/refman-6.0/information-schema.xml 2008-05-15 19:15:51 UTC (rev 10750)
Changed blocks: 1, Lines Added: 224, Lines Deleted: 0; 7260 bytes
@@ -5932,6 +5932,230 @@
</section>
+ <section id="profiling-table">
+
+ <title>The <literal>INFORMATION_SCHEMA PROFILING</literal> Table</title>
+ &cs-only;
+
+ <indexterm>
+ <primary>PROFILING</primary>
+ <secondary>INFORMATION_SCHEMA table</secondary>
+ </indexterm>
+
+ <para>
+ The <literal>PROFILING</literal> table provides statement
+ profiling information. Its contents correspond to the information
+ produced by the <literal>SHOW PROFILES</literal> and <literal>SHOW
+ PROFILE</literal> statements (see
+ <xref linkend="show-profiles"/>). The table is empty unless the
+ <literal>profiling</literal> session variable is set to 1.
+ </para>
+
+ <informaltable>
+ <tgroup cols="3">
+ <colspec colwidth="40*"/>
+ <colspec colwidth="30*"/>
+ <colspec colwidth="30*"/>
+ <tbody>
+ <row>
+ <entry><emphasis role="bold"><literal>INFORMATION_SCHEMA</literal>
+ Name</emphasis></entry>
+ <entry><emphasis role="bold"><literal>SHOW</literal> Name</emphasis></entry>
+ <entry><emphasis role="bold">Remarks</emphasis></entry>
+ </row>
+ <row>
+ <entry><literal>QUERY_ID</literal></entry>
+ <entry><literal>Query_ID</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>SEQ</literal></entry>
+ <entry><literal/></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>STATE</literal></entry>
+ <entry><literal>Status</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>DURATION</literal></entry>
+ <entry><literal>Duration</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>CPU_USER</literal></entry>
+ <entry><literal>CPU_user</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>CPU_SYSTEM</literal></entry>
+ <entry><literal>CPU_system</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>CONTEXT_VOLUNTARY</literal></entry>
+ <entry><literal>Context_voluntary</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>CONTEXT_INVOLUNTARY</literal></entry>
+ <entry><literal>Context_involuntary</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>BLOCK_OPS_IN</literal></entry>
+ <entry><literal>Block_ops_in</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>BLOCK_OPS_OUT</literal></entry>
+ <entry><literal>Block_ops_out</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>MESSAGES_SENT</literal></entry>
+ <entry><literal>Messages_sent</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>MESSAGES_RECEIVED</literal></entry>
+ <entry><literal>Messages_received</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>PAGE_FAULTS_MAJOR</literal></entry>
+ <entry><literal>Page_faults_major</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>PAGE_FAULTS_MINOR</literal></entry>
+ <entry><literal>Page_faults_minor</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>SWAPS</literal></entry>
+ <entry><literal>Swaps</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>SOURCE_FUNCTION</literal></entry>
+ <entry><literal>Source_function</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>SOURCE_FILE</literal></entry>
+ <entry><literal>Source_file</literal></entry>
+ <entry/>
+ </row>
+ <row>
+ <entry><literal>SOURCE_LINE</literal></entry>
+ <entry><literal>Source_line</literal></entry>
+ <entry/>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+
+ <para>
+ <emphasis role="bold">Notes</emphasis>:
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ The <literal>PROFILING</literal> table was added in MySQL
+ 6.0.5.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>QUERY_ID</literal> is a numeric statement identifier.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>SEQ</literal> is a sequence number indicating the
+ display order for rows with the same
+ <literal>QUERY_ID</literal> value.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>STATE</literal> is the profiling state to which the
+ row measurements apply.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>DURATION</literal> indicates how long statement
+ execution remained in the given state, in seconds.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>CPU_USER</literal> and <literal>CPU_SYSTEM</literal>
+ indicate user and system CPU use, in seconds.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>CONTEXT_VOLUNTARY</literal> and
+ <literal>CONTEXT_INVOLUNTARY</literal> indicate how many
+ voluntary and involuntary context switches occurred.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>BLOCK_OPS_IN</literal> and
+ <literal>BLOCK_OPS_OUT</literal> indicate the number of block
+ input and output operations.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>MESSAGES_SENT</literal> and
+ <literal>MESSAGES_RECEIVED</literal> indicate the number of
+ communication messages sent and received.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>PAGE_FAULTS_MAJOR</literal> and
+ <literal>PAGE_FAULTS_MINOR</literal> indicate the number of
+ major and minor page faults.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>SWAPS</literal> indicates how many swaps occurred.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>SOURCE_FUNCTION</literal>,
+ <literal>SOURCE_FILE</literal>, and
+ <literal>SOURCE_LINE</literal> provide information indicating
+ where in the source code the profiled state executes.
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ </section>
+
<section id="other-information-schema-tables">
<title>Other <literal>INFORMATION_SCHEMA</literal> Tables</title>
Modified: trunk/refman-6.0/installing-core.xml
===================================================================
--- trunk/refman-6.0/installing-core.xml 2008-05-15 18:26:50 UTC (rev 10749)
+++ trunk/refman-6.0/installing-core.xml 2008-05-15 19:15:51 UTC (rev 10750)
Changed blocks: 1, Lines Added: 20, Lines Deleted: 0; 1149 bytes
@@ -8303,6 +8303,26 @@
<listitem>
<para>
+ <indexterm>
+ <primary>configure</primary>
+ <secondary>enable-profiling option</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>enable-profiling option</primary>
+ <secondary>configure</secondary>
+ </indexterm>
+
+ This option enables the statement profiling capability
+ exposed by the <literal>SHOW PROFILE</literal> and
+ <literal>SHOW PROFILES</literal> statements. (See
+ <xref linkend="show-profiles"/>.) The option was added in
+ MySQL 6.0.5.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
See <xref linkend="operating-system-specific-notes"/>, for
options that pertain to particular operating systems.
</para>
Modified: trunk/refman-6.0/optimization.xml
===================================================================
--- trunk/refman-6.0/optimization.xml 2008-05-15 18:26:50 UTC (rev 10749)
+++ trunk/refman-6.0/optimization.xml 2008-05-15 19:15:51 UTC (rev 10750)
Changed blocks: 3, Lines Added: 13, Lines Deleted: 2; 1613 bytes
@@ -12087,6 +12087,13 @@
<listitem>
<para>
+ The <literal>SHOW PROFILE</literal> statement
+ (<xref linkend="show-profiles"/>)
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
The <literal>INFORMATION_SCHEMA</literal>
<literal>PROCESSLIST</literal> table
(<xref linkend="processlist-table"/>)
@@ -13964,7 +13971,9 @@
disable external system locks with the
<option>--skip-external-locking</option> option. However,
external locking is disabled by default, so it is likely
- that this option will have no effect.
+ that this option will have no effect. For <literal>SHOW
+ PROFILE</literal>, this state means the thread is
+ requesting the lock (not waiting for it).
</para>
</listitem>
@@ -14074,7 +14083,9 @@
<para>
The thread is going to request or is waiting for an
advisory lock requested with a
- <function role="sql">GET_LOCK()</function> call.
+ <function role="sql">GET_LOCK()</function> call. For
+ <literal>SHOW PROFILE</literal>, this state means the
+ thread is requesting the lock (not waiting for it).
</para>
</listitem>
Modified: trunk/refman-6.0/sql-syntax.xml
===================================================================
--- trunk/refman-6.0/sql-syntax.xml 2008-05-15 18:26:50 UTC (rev 10749)
+++ trunk/refman-6.0/sql-syntax.xml 2008-05-15 19:15:51 UTC (rev 10750)
Changed blocks: 3, Lines Added: 342, Lines Deleted: 0; 12099 bytes
@@ -19593,6 +19593,16 @@
<indexterm>
<primary>SET</primary>
+ <secondary>PROFILING</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>SET</primary>
+ <secondary>PROFILING_HISTORY_SIZE</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>SET</primary>
<secondary>SQL_AUTO_IS_NULL</secondary>
</indexterm>
@@ -20279,6 +20289,37 @@
<listitem>
<para>
+ <literal>PROFILING = {0 | 1}</literal>
+ </para>
+
+ <para>
+ If set to 0 (the default), statement profiling is disabled.
+ If set to 1, statement profiling is enabled and the
+ <literal>SHOW PROFILES</literal> and <literal>SHOW
+ PROFILE</literal> statements provide access to profiling
+ information. See <xref linkend="show-profiles"/>. This
+ variable was added in MySQL 6.0.5.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>PROFILING_HISTORY_SIZE =
+ <replaceable>value</replaceable></literal>
+ </para>
+
+ <para>
+ The number of statements for which to maintain profiling
+ information if <literal>PROFILING</literal> is enabled. The
+ default value is 15. The maximum value is 100. Setting the
+ value to 0 effectively disables profiling. See
+ <xref linkend="show-profiles"/>. This variable was added in
+ MySQL 6.0.5.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
<literal>SQL_AUTO_IS_NULL = {0 | 1}</literal>
</para>
@@ -23594,6 +23635,307 @@
</section>
+ <section id="show-profiles">
+
+ <title><literal>SHOW PROFILES</literal> and <literal>SHOW PROFILE</literal>
+ Syntax</title>
+ &cs-only;
+
+ <indexterm>
+ <primary>SHOW PROFILES</primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>SHOW PROFILE</primary>
+ </indexterm>
+
+ <remark role="help-topic" condition="SHOW PROFILES"/>
+
+ <remark role="help-keywords">
+ SHOW PROFILES PROFILE
+ </remark>
+
+ <remark role="help-syntax"/>
+
+<programlisting>
+SHOW PROFILES
+
+SHOW PROFILE [<replaceable>type</replaceable> [, <replaceable>type</replaceable>] ... ]
+ [FOR QUERY <replaceable>n</replaceable>]
+ [LIMIT <replaceable>row_count</replaceable> [OFFSET <replaceable>offset</replaceable>]]
+
+<replaceable>type</replaceable>:
+ ALL
+ | BLOCK IO
+ | CONTEXT SWITCHES
+ | CPU
+ | IPC
+ | MEMORY
+ | PAGE FAULTS
+ | SOURCE
+ | SWAPS
+</programlisting>
+
+ <remark role="help-description-begin"/>
+
+ <para>
+ The <literal>SHOW PROFILES</literal> and <literal>SHOW
+ PROFILE</literal> statements display profiling information
+ that indicates resource usage for statements executed during
+ the course of the current session.
+ </para>
+
+ <para>
+ Profiling is controlled by the <literal>profiling</literal>
+ session variable, which has a default value of 0
+ (<literal>OFF</literal>). Profiling is enabled by setting
+ <literal>profiling</literal> to 1 or <literal>ON</literal>:
+ </para>
+
+<programlisting>
+mysql> <userinput>SET profiling = 1;</userinput>
+</programlisting>
+
+ <para>
+ <literal>SHOW PROFILES</literal> displays a list of the most
+ recent statements sent to the master. The size of the list is
+ controlled by the <literal>profiling_history_size</literal>
+ session variable, which has a default value of 15. The maximum
+ value is 100. Setting the value to 0 has the practical effect
+ of disabling profiling.
+ </para>
+
+ <para>
+ All statements are profiled except <literal>SHOW
+ PROFILES</literal> and <literal>SHOW PROFILE</literal>, so you
+ will find neither of those statements in the profile list.
+ Malformed statements are profiled. For example, <literal>SHOW
+ PROFILING</literal> is an illegal statement, and a syntax
+ error occurs if you try to execute it, but it will show up in
+ the profiling list.
+ </para>
+
+ <para>
+ <literal>SHOW PROFILE</literal> displays detailed information
+ about a single statement. Without the <literal>FOR QUERY
+ <replaceable>n</replaceable></literal> clause, the output
+ pertains to the most recently executed statement. If
+ <literal>FOR QUERY <replaceable>n</replaceable></literal> is
+ included, <literal>SHOW PROFILE</literal> displays information
+ for statement <replaceable>n</replaceable>. The values of
+ <replaceable>n</replaceable> correspond to the
+ <literal>Query_ID</literal> values displayed by <literal>SHOW
+ PROFILES</literal>.
+ </para>
+
+ <para>
+ The <literal>LIMIT
+ <replaceable>row_count</replaceable></literal> clause may be
+ given to limit the output to
+ <replaceable>row_count</replaceable> rows. If
+ <literal>LIMIT</literal> is given, <literal>OFFSET
+ <replaceable>offset</replaceable></literal> may be added to
+ begin the output <replaceable>offset</replaceable> rows into
+ the full set of rows.
+ </para>
+
+ <para>
+ By default, <literal>SHOW PROFILE</literal> displays
+ <literal>Status</literal> and <literal>Duration</literal>
+ columns. The <literal>Status</literal> values are like the
+ <literal>State</literal> values displayed by <literal>SHOW
+ PROCESSLIST</literal>, althought there might be some minor
+ differences in interpretion for the two statements for some
+ status values (see <xref linkend="thread-information"/>).
+ </para>
+
+ <para>
+ Optional <replaceable>type</replaceable> values may be
+ specified to display specific additional types of information:
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ <literal>ALL</literal> displays all information
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>BLOCK IO</literal> displays counts for block
+ input and output operations
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>CONTEXT SWITCHES</literal> displays counts for
+ voluntary and involuntary context switches
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>CPU</literal> displays user and system CPU usage
+ times
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>IPC</literal> displays counts for messages sent
+ and received
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>MEMORY</literal> is not currently implemented
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>PAGE FAULTS</literal> displays counts for major
+ and minor page faults
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>SOURCE</literal> displays the names of functions
+ from the source code, together with the name and line
+ number of the file in which the function occurs
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>SWAPS</literal> displays swap counts
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ Profiling is enabled per session. When a session ends, its
+ profiling information is lost.
+ </para>
+
+ <remark role="help-description-end"/>
+
+ <remark role="help-example-begin"/>
+
+<programlisting>
+mysql> <userinput>SELECT @@profiling;</userinput>
++-------------+
+| @@profiling |
++-------------+
+| 0 |
++-------------+
+1 row in set (0.00 sec)
+
+mysql> <userinput>SET profiling = 1;</userinput>
+Query OK, 0 rows affected (0.00 sec)
+
+mysql> <userinput>DROP TABLE IF EXISTS t1;</userinput>
+Query OK, 0 rows affected, 1 warning (0.00 sec)
+
+mysql> <userinput>CREATE TABLE T1 (id INT);</userinput>
+Query OK, 0 rows affected (0.01 sec)
+
+mysql> <userinput>SHOW PROFILES;</userinput>
++----------+----------+--------------------------+
+| Query_ID | Duration | Query |
++----------+----------+--------------------------+
+| 0 | 0.000088 | SET PROFILING = 1 |
+| 1 | 0.000136 | DROP TABLE IF EXISTS t1 |
+| 2 | 0.011947 | CREATE TABLE t1 (id INT) |
++----------+----------+--------------------------+
+3 rows in set (0.00 sec)
+
+mysql> <userinput>SHOW PROFILE;</userinput>
++----------------------+----------+
+| Status | Duration |
++----------------------+----------+
+| checking permissions | 0.000040 |
+| creating table | 0.000056 |
+| After create | 0.011363 |
+| query end | 0.000375 |
+| freeing items | 0.000089 |
+| logging slow query | 0.000019 |
+| cleaning up | 0.000005 |
++----------------------+----------+
+7 rows in set (0.00 sec)
+
+mysql> <userinput>SHOW PROFILE FOR QUERY 1;</userinput>
++--------------------+----------+
+| Status | Duration |
++--------------------+----------+
+| query end | 0.000107 |
+| freeing items | 0.000008 |
+| logging slow query | 0.000015 |
+| cleaning up | 0.000006 |
++--------------------+----------+
+4 rows in set (0.00 sec)
+
+mysql> <userinput>SHOW PROFILE CPU FOR QUERY 2;</userinput>
++----------------------+----------+----------+------------+
+| Status | Duration | CPU_user | CPU_system |
++----------------------+----------+----------+------------+
+| checking permissions | 0.000040 | 0.000038 | 0.000002 |
+| creating table | 0.000056 | 0.000028 | 0.000028 |
+| After create | 0.011363 | 0.000217 | 0.001571 |
+| query end | 0.000375 | 0.000013 | 0.000028 |
+| freeing items | 0.000089 | 0.000010 | 0.000014 |
+| logging slow query | 0.000019 | 0.000009 | 0.000010 |
+| cleaning up | 0.000005 | 0.000003 | 0.000002 |
++----------------------+----------+----------+------------+
+7 rows in set (0.00 sec)
+</programlisting>
+
+ <remark role="help-example-end"/>
+
+ <para>
+ Profiling is only partially functional on some architectures.
+ For values that depend on the <literal>getrusage()</literal>
+ system call, <literal>NULL</literal> is returned on systems
+ that do not support the call.
+ </para>
+
+ <para>
+ <literal>SHOW PROFILES</literal> and <literal>SHOW
+ PROFILE</literal> were added in MySQL 6.0.5.
+ </para>
+
+ <para>
+ You can also get profiling information from the
+ <literal>PROFILING</literal> table in
+ <literal>INFORMATION_SCHEMA</literal>. See
+ <xref linkend="profiling-table"/>. For example, the following
+ queries produce the same result:
+ </para>
+
+<programlisting>
+SHOW PROFILE FOR QUERY 2;
+
+SELECT STATE, FORMAT(DURATION, 6) AS DURATION
+FROM INFORMATION_SCHEMA.PROFILING
+WHERE QUERY_ID = 2 ORDER BY SEQ;
+</programlisting>
+
+ <important>
+ <para>
+ Please note that the <literal>SHOW PROFILE</literal> and
+ <literal>SHOW PROFILES</literal> functionality is part of
+ the MySQL 5.0 Community Server only.
+ </para>
+ </important>
+
+ </section>
+
<section id="show-status">
<title><literal>SHOW STATUS</literal> Syntax</title>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r10750 - in trunk: . dynamic-docs/build-configure dynamic-docs/changelog refman-5.0 refman-5.1 refman-6.0 | paul | 15 May |