Commit 5f22e83a authored by Sergei Petrunia's avatar Sergei Petrunia

Make the Optimizer Trace of reqular query and PS EXECUTE be identical

Print this piece when we've just made the choice to convert to semi-join.
Also, print it when we've already made that choice before:

  transformation": {
     "select_id": 2,
     "from": "IN (SELECT)",
     "to": "semijoin",
     "chosen": true
   }
parent 51c89849
--- /Users/shulga/projects/mariadb/server-10.6/mysql-test/main/opt_trace.result 2021-07-21 19:17:11.000000000 +0700
+++ /Users/shulga/projects/mariadb/server-10.6/mysql-test/main/opt_trace.reject 2021-07-21 19:17:48.000000000 +0700
@@ -2829,14 +2829,6 @@
}
},
{
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#2 */ select t10.pk from t10"
}
]
@@ -4402,14 +4394,6 @@
}
},
{
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#2 */ select t_inner_1.a from t1 t_inner_1 join t1 t_inner_2"
}
]
@@ -4852,14 +4836,6 @@
}
},
{
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#2 */ select t_inner_1.a from t2 t_inner_2 join t1 t_inner_1"
}
]
@@ -4879,14 +4855,6 @@
}
},
{
- "transformation": {
- "select_id": 3,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#3 */ select t_inner_3.a from t2 t_inner_3 join t1 t_inner_4"
}
]
@@ -6432,14 +6400,6 @@
}
},
{
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#2 */ select t_inner_1.a from t2 t_inner_2 join t1 t_inner_1"
}
]
@@ -6459,14 +6419,6 @@
}
},
{
- "transformation": {
- "select_id": 3,
- "from": "IN (SELECT)",
- "to": "semijoin",
- "chosen": true
- }
- },
- {
"expanded_query": "/* select#3 */ select t_inner_3.a from t2 t_inner_3 join t1 t_inner_4"
}
]
--source include/not_embedded.inc
--source include/have_sequence.inc
--source include/protocol.inc
SELECT table_name, column_name FROM information_schema.columns where table_name="OPTIMIZER_TRACE";
set optimizer_trace="enabled=on";
show variables like 'optimizer_trace';
......
......@@ -717,6 +717,15 @@ int check_and_do_in_subquery_rewrites(JOIN *join)
if (arena)
thd->restore_active_arena(arena, &backup);
in_subs->is_registered_semijoin= TRUE;
}
/*
Print the transformation into trace. Do it when we've just set
is_registered_semijoin=TRUE above, and also do it when we've already
had it set.
*/
if (in_subs->is_registered_semijoin)
{
OPT_TRACE_TRANSFORM(thd, trace_wrapper, trace_transform,
select_lex->select_number,
"IN (SELECT)", "semijoin");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment