summaryrefslogtreecommitdiff
path: root/sql/my_json_writer.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2019-02-13 11:22:16 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2019-02-13 11:52:36 +0530
commitbe8709eb7bdf2a68a1c04fd8ab368113f5f39b63 (patch)
tree35585804a654ec75089a92e90d546f73e7f60b68 /sql/my_json_writer.cc
parent6b979416e0e4eac0a036ca5f2b81b748a3d2e680 (diff)
downloadmariadb-git-be8709eb7bdf2a68a1c04fd8ab368113f5f39b63.tar.gz
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.
Diffstat (limited to 'sql/my_json_writer.cc')
-rw-r--r--sql/my_json_writer.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/sql/my_json_writer.cc b/sql/my_json_writer.cc
index 9c4d63f9c4a..7ae0c58bd7d 100644
--- a/sql/my_json_writer.cc
+++ b/sql/my_json_writer.cc
@@ -219,19 +219,20 @@ void Json_writer::add_str(const String &str)
add_str(str.ptr(), str.length());
}
-Json_writer_object::Json_writer_object(Json_writer *writer):Json_writer_struct(writer)
+Json_writer_object::Json_writer_object(THD *thd) :
+ Json_writer_struct(thd)
{
if (my_writer)
my_writer->start_object();
}
-Json_writer_object::Json_writer_object(Json_writer *writer, const char *str)
- :Json_writer_struct(writer)
+Json_writer_object::Json_writer_object(THD* thd, const char *str)
+ : Json_writer_struct(thd)
{
if (my_writer)
my_writer->add_member(str).start_object();
-
}
+
Json_writer_object::~Json_writer_object()
{
if (!closed && my_writer)
@@ -239,14 +240,15 @@ Json_writer_object::~Json_writer_object()
closed= TRUE;
}
-Json_writer_array::Json_writer_array(Json_writer *writer):Json_writer_struct(writer)
+Json_writer_array::Json_writer_array(THD *thd) :
+ Json_writer_struct(thd)
{
if (my_writer)
my_writer->start_array();
}
-Json_writer_array::Json_writer_array(Json_writer *writer, const char *str)
- :Json_writer_struct(writer)
+Json_writer_array::Json_writer_array(THD *thd, const char *str)
+ :Json_writer_struct(thd)
{
if (my_writer)
my_writer->add_member(str).start_array();