Commit 27d9986c authored by Monty's avatar Monty

Added more digits to JSON output of double

sprintf() format of double changed from '%lg' to '%-.11lg'

The change was to make it easier to read optimizer trace output
with tables that has millions of records.
parent 8d74d30d
...@@ -192,7 +192,7 @@ ANALYZE ...@@ -192,7 +192,7 @@ ANALYZE
"buffer_size": "1Kb", "buffer_size": "1Kb",
"join_type": "BNL", "join_type": "BNL",
"attached_condition": "tbl1.c > tbl2.c", "attached_condition": "tbl1.c > tbl2.c",
"r_filtered": 15.833 "r_filtered": 15.83333333
} }
} }
} }
...@@ -421,7 +421,7 @@ ANALYZE ...@@ -421,7 +421,7 @@ ANALYZE
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
"r_filtered": 98.135 "r_filtered": 98.13542689
} }
} }
} }
......
...@@ -516,7 +516,7 @@ ANALYZE ...@@ -516,7 +516,7 @@ ANALYZE
"buffer_size": "119", "buffer_size": "119",
"join_type": "BNL", "join_type": "BNL",
"attached_condition": "t5.a = t6.a", "attached_condition": "t5.a = t6.a",
"r_filtered": 21.429 "r_filtered": 21.42857143
} }
} }
} }
......
...@@ -15165,7 +15165,7 @@ EXPLAIN ...@@ -15165,7 +15165,7 @@ EXPLAIN
"access_type": "ALL", "access_type": "ALL",
"possible_keys": ["idx_b"], "possible_keys": ["idx_b"],
"rows": 12, "rows": 12,
"filtered": 83.333, "filtered": 83.33333588,
"attached_condition": "t1.b <= 5 and t1.a is not null" "attached_condition": "t1.b <= 5 and t1.a is not null"
}, },
"table": { "table": {
...@@ -15438,7 +15438,7 @@ EXPLAIN ...@@ -15438,7 +15438,7 @@ EXPLAIN
"access_type": "ALL", "access_type": "ALL",
"possible_keys": ["idx_b"], "possible_keys": ["idx_b"],
"rows": 12, "rows": 12,
"filtered": 83.333, "filtered": 83.33333588,
"attached_condition": "t3.b <= 15 and t3.a is not null and t3.c is not null" "attached_condition": "t3.b <= 15 and t3.a is not null and t3.c is not null"
}, },
"table": { "table": {
...@@ -15590,7 +15590,7 @@ EXPLAIN ...@@ -15590,7 +15590,7 @@ EXPLAIN
"access_type": "ALL", "access_type": "ALL",
"possible_keys": ["idx_b"], "possible_keys": ["idx_b"],
"rows": 12, "rows": 12,
"filtered": 83.333, "filtered": 83.33333588,
"attached_condition": "t3.b <= 15 and t3.a is not null and t3.c is not null" "attached_condition": "t3.b <= 15 and t3.a is not null and t3.c is not null"
}, },
"table": { "table": {
...@@ -15821,7 +15821,7 @@ EXPLAIN ...@@ -15821,7 +15821,7 @@ EXPLAIN
"table_name": "t2", "table_name": "t2",
"access_type": "ALL", "access_type": "ALL",
"rows": 90, "rows": 90,
"filtered": 63.281, "filtered": 63.28125,
"attached_condition": "t2.b < 40 and t2.a is not null" "attached_condition": "t2.b < 40 and t2.a is not null"
}, },
"table": { "table": {
...@@ -16317,7 +16317,7 @@ EXPLAIN ...@@ -16317,7 +16317,7 @@ EXPLAIN
"table_name": "t2", "table_name": "t2",
"access_type": "ALL", "access_type": "ALL",
"rows": 90, "rows": 90,
"filtered": 63.281, "filtered": 63.28125,
"attached_condition": "t2.b < 40 and t2.a is not null" "attached_condition": "t2.b < 40 and t2.a is not null"
}, },
"table": { "table": {
......
...@@ -6129,7 +6129,7 @@ EXPLAIN ...@@ -6129,7 +6129,7 @@ EXPLAIN
"key_length": "10", "key_length": "10",
"used_key_parts": ["kp1", "kp2"], "used_key_parts": ["kp1", "kp2"],
"rows": 836, "rows": 836,
"filtered": 76.434, "filtered": 76.43428802,
"index_condition": "b.kp2 <= 10", "index_condition": "b.kp2 <= 10",
"attached_condition": "b.kp2 <= 10 and b.col1 + 1 < 33333" "attached_condition": "b.kp2 <= 10 and b.col1 + 1 < 33333"
}, },
......
This source diff could not be displayed because it is too large. You can view the blob instead.
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_sequence.inc
SELECT table_name, column_name FROM information_schema.columns where table_name="OPTIMIZER_TRACE"; SELECT table_name, column_name FROM information_schema.columns where table_name="OPTIMIZER_TRACE";
show variables like 'optimizer_trace'; show variables like 'optimizer_trace';
set optimizer_trace="enabled=on"; set optimizer_trace="enabled=on";
...@@ -567,4 +568,12 @@ select * from t3 where (a,a) in (select t1.a, t2.a from t1, t2 where t1.b=t2.b); ...@@ -567,4 +568,12 @@ select * from t3 where (a,a) in (select t1.a, t2.a from t1, t2 where t1.b=t2.b);
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.semijoin_table_pullout')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; select JSON_DETAILED(JSON_EXTRACT(trace, '$**.semijoin_table_pullout')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
drop table t1,t2,t3; drop table t1,t2,t3;
--echo #
--echo # Test many rows to see output of big cost numbers
--echo #
select count(*) from seq_1_to_10000000;
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
set optimizer_trace='enabled=off'; set optimizer_trace='enabled=off';
...@@ -117,7 +117,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { ...@@ -117,7 +117,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"using_mrr": false, "using_mrr": false,
"index_only": false, "index_only": false,
"rows": 1000, "rows": 1000,
"cost": 201.65, "cost": 201.6536043,
"chosen": true "chosen": true
}, },
{ {
...@@ -127,7 +127,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { ...@@ -127,7 +127,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"using_mrr": false, "using_mrr": false,
"index_only": false, "index_only": false,
"rows": 1, "rows": 1,
"cost": 1.3451, "cost": 1.345146475,
"chosen": true "chosen": true
} }
], ],
...@@ -135,10 +135,10 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { ...@@ -135,10 +135,10 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"intersecting_indexes": [ "intersecting_indexes": [
{ {
"index": "key1", "index": "key1",
"index_scan_cost": 1.0001, "index_scan_cost": 1.000146475,
"cumulated_index_scan_cost": 1.0001, "cumulated_index_scan_cost": 1.000146475,
"disk_sweep_cost": 1.0014, "disk_sweep_cost": 1.001383604,
"cumulative_total_cost": 2.0015, "cumulative_total_cost": 2.00153008,
"usable": true, "usable": true,
"matching_rows_now": 1, "matching_rows_now": 1,
"intersect_covering_with_this_index": false, "intersect_covering_with_this_index": false,
...@@ -166,7 +166,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { ...@@ -166,7 +166,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"ranges": ["(1) <= (key1) <= (1)"] "ranges": ["(1) <= (key1) <= (1)"]
}, },
"rows_for_plan": 1, "rows_for_plan": 1,
"cost_for_plan": 1.3451, "cost_for_plan": 1.345146475,
"chosen": true "chosen": true
} }
} }
...@@ -176,7 +176,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { ...@@ -176,7 +176,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"rowid_filters": [ "rowid_filters": [
{ {
"key": "key1", "key": "key1",
"build_cost": 0.1301, "build_cost": 0.130146475,
"rows": 1 "rows": 1
} }
] ]
...@@ -209,7 +209,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { ...@@ -209,7 +209,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"index": "key1", "index": "key1",
"used_range_estimates": true, "used_range_estimates": true,
"rows": 1, "rows": 1,
"cost": 1.1251, "cost": 1.125146475,
"chosen": true "chosen": true
}, },
{ {
...@@ -221,12 +221,12 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { ...@@ -221,12 +221,12 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"chosen_access_method": { "chosen_access_method": {
"type": "ref", "type": "ref",
"records": 1, "records": 1,
"cost": 1.1251, "cost": 1.125146475,
"uses_join_buffering": false "uses_join_buffering": false
} }
}, },
"rows_for_plan": 1, "rows_for_plan": 1,
"cost_for_plan": 1.3251, "cost_for_plan": 1.325146475,
"estimated_join_cardinality": 1 "estimated_join_cardinality": 1
} }
] ]
......
...@@ -80,7 +80,7 @@ select * from db1.t1 { ...@@ -80,7 +80,7 @@ select * from db1.t1 {
"table": "t1", "table": "t1",
"table_scan": { "table_scan": {
"rows": 3, "rows": 3,
"cost": 2.0051 "cost": 2.005126953
} }
} }
] ]
...@@ -95,19 +95,19 @@ select * from db1.t1 { ...@@ -95,19 +95,19 @@ select * from db1.t1 {
{ {
"access_type": "scan", "access_type": "scan",
"resulting_rows": 3, "resulting_rows": 3,
"cost": 2.0051, "cost": 2.005126953,
"chosen": true "chosen": true
} }
], ],
"chosen_access_method": { "chosen_access_method": {
"type": "scan", "type": "scan",
"records": 3, "records": 3,
"cost": 2.0051, "cost": 2.005126953,
"uses_join_buffering": false "uses_join_buffering": false
} }
}, },
"rows_for_plan": 3, "rows_for_plan": 3,
"cost_for_plan": 2.6051, "cost_for_plan": 2.605126953,
"estimated_join_cardinality": 3 "estimated_join_cardinality": 3
} }
] ]
...@@ -203,7 +203,7 @@ select * from db1.v1 { ...@@ -203,7 +203,7 @@ select * from db1.v1 {
"table": "t1", "table": "t1",
"table_scan": { "table_scan": {
"rows": 3, "rows": 3,
"cost": 2.0051 "cost": 2.005126953
} }
} }
] ]
...@@ -218,19 +218,19 @@ select * from db1.v1 { ...@@ -218,19 +218,19 @@ select * from db1.v1 {
{ {
"access_type": "scan", "access_type": "scan",
"resulting_rows": 3, "resulting_rows": 3,
"cost": 2.0051, "cost": 2.005126953,
"chosen": true "chosen": true
} }
], ],
"chosen_access_method": { "chosen_access_method": {
"type": "scan", "type": "scan",
"records": 3, "records": 3,
"cost": 2.0051, "cost": 2.005126953,
"uses_join_buffering": false "uses_join_buffering": false
} }
}, },
"rows_for_plan": 3, "rows_for_plan": 3,
"cost_for_plan": 2.6051, "cost_for_plan": 2.605126953,
"estimated_join_cardinality": 3 "estimated_join_cardinality": 3
} }
] ]
......
...@@ -38,7 +38,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) ...@@ -38,7 +38,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
"using_mrr": false, "using_mrr": false,
"index_only": false, "index_only": false,
"rows": 2, "rows": 2,
"cost": 2.5477, "cost": 2.547733708,
"chosen": true "chosen": true
} }
], ],
......
...@@ -2611,10 +2611,10 @@ EXPLAIN ...@@ -2611,10 +2611,10 @@ EXPLAIN
"used_key_parts": ["e"] "used_key_parts": ["e"]
}, },
"rows": 15, "rows": 15,
"selectivity_pct": 14.423 "selectivity_pct": 14.42307692
}, },
"rows": 8, "rows": 8,
"filtered": 14.423, "filtered": 14.42307663,
"index_condition": "t2.d is not null", "index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1" "attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1"
}, },
...@@ -2716,10 +2716,10 @@ EXPLAIN ...@@ -2716,10 +2716,10 @@ EXPLAIN
"used_key_parts": ["e"] "used_key_parts": ["e"]
}, },
"rows": 7, "rows": 7,
"selectivity_pct": 6.7308 "selectivity_pct": 6.730769231
}, },
"rows": 7, "rows": 7,
"filtered": 6.7308, "filtered": 6.730769157,
"index_condition": "t2.d is not null", "index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1" "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1"
}, },
......
...@@ -2605,7 +2605,7 @@ EXPLAIN ...@@ -2605,7 +2605,7 @@ EXPLAIN
"key_length": "5", "key_length": "5",
"used_key_parts": ["d"], "used_key_parts": ["d"],
"rows": 8, "rows": 8,
"filtered": 14.423, "filtered": 14.42307663,
"index_condition": "t2.d is not null", "index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1", "attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1",
"mrr_type": "Rowid-ordered scan" "mrr_type": "Rowid-ordered scan"
...@@ -2703,7 +2703,7 @@ EXPLAIN ...@@ -2703,7 +2703,7 @@ EXPLAIN
"key_length": "5", "key_length": "5",
"used_key_parts": ["d"], "used_key_parts": ["d"],
"rows": 7, "rows": 7,
"filtered": 6.7308, "filtered": 6.730769157,
"index_condition": "t2.d is not null", "index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1", "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1",
"mrr_type": "Rowid-ordered scan" "mrr_type": "Rowid-ordered scan"
......
This diff is collapsed.
This diff is collapsed.
...@@ -183,7 +183,7 @@ void Json_writer::add_double(double val) ...@@ -183,7 +183,7 @@ void Json_writer::add_double(double val)
#if __has_feature(memory_sanitizer) // FIXME: remove this workaround for #if __has_feature(memory_sanitizer) // FIXME: remove this workaround for
__msan_unpoison(&val, sizeof val); // main.range_mrr_icp & many other tests __msan_unpoison(&val, sizeof val); // main.range_mrr_icp & many other tests
#endif #endif
size_t len= my_snprintf(buf, sizeof(buf), "%lg", val); size_t len= my_snprintf(buf, sizeof(buf), "%-.11lg", val);
add_unquoted_str(buf, len); add_unquoted_str(buf, len);
} }
......
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