[Commits] Rev 4282: MDEV-6430: It is impossible to see if "filesort with small limit" optimization was used in file:///home/psergey/dev2/10.0-cp2/

Sergey Petrunya psergey at askmonty.org
Wed Jul 9 11:33:07 EEST 2014


At file:///home/psergey/dev2/10.0-cp2/

------------------------------------------------------------
revno: 4282
revision-id: psergey at askmonty.org-20140709083200-8rewwbeneaya7bs1
parent: jplindst at mariadb.org-20140708180518-tscl9reug0whjk6x
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: 10.0-cp2
timestamp: Wed 2014-07-09 12:32:00 +0400
message:
  MDEV-6430: It is impossible to see if "filesort with small limit" optimization was used
  - Make log_slow_verbosity print "Priority_queue: (Yes|No)" into the slow query log.
    (but we do not add a correspoding column to P_S.*statement* tables).
=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc	2014-06-12 08:57:03 +0000
+++ b/sql/filesort.cc	2014-07-09 08:32:00 +0000
@@ -225,6 +225,7 @@ ha_rows filesort(THD *thd, TABLE *table,
                              table, num_rows, memory_available))
   {
     DBUG_PRINT("info", ("filesort PQ is applicable"));
+    thd->query_plan_flags|= QPLAN_FILESORT_PRIORITY_QUEUE;
     const size_t compare_length= param.sort_length;
     if (pq.init(param.max_rows,
                 true,                           // max_at_top

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2014-06-25 11:08:30 +0000
+++ b/sql/log.cc	2014-07-09 08:32:00 +0000
@@ -2904,7 +2904,8 @@ bool MYSQL_QUERY_LOG::write(THD *thd, ti
          my_b_printf(&log_file,
                      "# Full_scan: %s  Full_join: %s  "
                      "Tmp_table: %s  Tmp_table_on_disk: %s\n"
-                     "# Filesort: %s  Filesort_on_disk: %s  Merge_passes: %lu\n",
+                     "# Filesort: %s  Filesort_on_disk: %s  Merge_passes: %lu  "
+                     "Priority_queue: %s\n",
                      ((thd->query_plan_flags & QPLAN_FULL_SCAN) ? "Yes" : "No"),
                      ((thd->query_plan_flags & QPLAN_FULL_JOIN) ? "Yes" : "No"),
                      ((thd->query_plan_flags & QPLAN_TMP_TABLE) ? "Yes" : "No"),
@@ -2912,7 +2913,10 @@ bool MYSQL_QUERY_LOG::write(THD *thd, ti
                      ((thd->query_plan_flags & QPLAN_FILESORT) ? "Yes" : "No"),
                      ((thd->query_plan_flags & QPLAN_FILESORT_DISK) ?
                       "Yes" : "No"),
-                     thd->query_plan_fsort_passes) == (size_t) -1)
+                     thd->query_plan_fsort_passes,
+                     ((thd->query_plan_flags & QPLAN_FILESORT_PRIORITY_QUEUE) ? 
+                       "Yes" : "No")
+                     ) == (size_t) -1)
        tmp_errno= errno;
     if (thd->variables.log_slow_verbosity & LOG_SLOW_VERBOSITY_EXPLAIN &&
         thd->lex->explain)

=== modified file 'sql/log_slow.h'
--- a/sql/log_slow.h	2013-09-19 04:33:58 +0000
+++ b/sql/log_slow.h	2014-07-09 08:32:00 +0000
@@ -31,6 +31,8 @@
 #define QPLAN_QC_NO           1 << 6
 #define QPLAN_TMP_DISK        1 << 7
 #define QPLAN_TMP_TABLE       1 << 8
+#define QPLAN_FILESORT_PRIORITY_QUEUE       1 << 9
+
 /* ... */
 #define QPLAN_MAX             ((ulong) 1) << 31 /* reserved as placeholder */
 



More information about the commits mailing list