From be8709eb7bdf2a68a1c04fd8ab368113f5f39b63 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Wed, 13 Feb 2019 11:22:16 +0530 Subject: MDEV-6111 Optimizer Trace This task involves the implementation for the optimizer trace. This feature produces a trace for any SELECT/UPDATE/DELETE/, which contains information about decisions taken by the optimizer during the optimization phase (choice of table access method, various costs, transformations, etc). This feature would help to tell why some decisions were taken by the optimizer and why some were rejected. Trace is session-local, controlled by the @@optimizer_trace variable. To enable optimizer trace we need to write: set @@optimizer_trace variable= 'enabled=on'; To display the trace one can run: SELECT trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; This task also involves: MDEV-18489: Limit the memory used by the optimizer trace introduces a switch optimizer_trace_max_mem_size which limits the memory used by the optimizer trace. This was implemented by Sergei Petrunia. --- sql/sql_test.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql/sql_test.h') diff --git a/sql/sql_test.h b/sql/sql_test.h index 867582a9569..cbef581b784 100644 --- a/sql/sql_test.h +++ b/sql/sql_test.h @@ -17,6 +17,7 @@ #define SQL_TEST_INCLUDED #include "mysqld.h" +#include "opt_trace_context.h" class JOIN; struct TABLE_LIST; @@ -34,6 +35,7 @@ void print_keyuse_array(DYNAMIC_ARRAY *keyuse_array); void print_sjm(SJ_MATERIALIZATION_INFO *sjm); void dump_TABLE_LIST_graph(SELECT_LEX *select_lex, TABLE_LIST* tl); #endif +void print_keyuse_array_for_trace(THD *thd, DYNAMIC_ARRAY *keyuse_array); void mysql_print_status(); #endif /* SQL_TEST_INCLUDED */ -- cgit v1.2.1