summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2021-11-19 12:17:14 +0300
committerSergei Petrunia <psergey@askmonty.org>2021-11-29 16:25:27 +0300
commit5f22e83a295c0439f1c73a6f666a3b58f2397632 (patch)
tree68e9dcc561f1c96acc9bbe6d9ad7f44267d75e29
parent51c89849d16f3f6cfadfa645c49815db3cbfece7 (diff)
downloadmariadb-git-5f22e83a295c0439f1c73a6f666a3b58f2397632.tar.gz
Make the Optimizer Trace of reqular query and PS EXECUTE be identicalbb-10.6-spetrunia
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 }
-rw-r--r--mysql-test/main/opt_trace,ps.rdiff92
-rw-r--r--mysql-test/main/opt_trace.test1
-rw-r--r--sql/opt_subselect.cc9
3 files changed, 9 insertions, 93 deletions
diff --git a/mysql-test/main/opt_trace,ps.rdiff b/mysql-test/main/opt_trace,ps.rdiff
deleted file mode 100644
index 3e2218de673..00000000000
--- a/mysql-test/main/opt_trace,ps.rdiff
+++ /dev/null
@@ -1,92 +0,0 @@
---- /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"
- }
- ]
diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test
index 70223560187..402caf2a165 100644
--- a/mysql-test/main/opt_trace.test
+++ b/mysql-test/main/opt_trace.test
@@ -1,6 +1,5 @@
--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';
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index dc93535bd87..99f75d9ad2f 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -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");