Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.4(EOL)
Description
JSON_DETAILED function (https://mariadb.com/kb/en/library/json_detailed/ ) is described as
Represents JSON in the most understandable way emphasizing nested structures.
|
We now got a use case for it: Optimizer Trace output. Optimizer trace is too large to be copied in full, instead we use expressions like
select
|
JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
|
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
Our experience is that JSON_DETAILED has some room for improvement when it comes to the quality of automatic JSON formatting.
Example:
source mdev19160-data.sql
|
mysql> select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200\G
|
*************************** 1. row ***************************
|
JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')): [
|
|
{
|
"range_scan_alternatives":
|
[
|
|
{
|
"index": "a_b",
|
"ranges":
|
[
|
"2 <= a <= 2 AND 4 <= b <= 4"
|
],
|
"rowid_ordered": true,
|
"using_mrr": false,
|
"index_only": true,
|
"rows": 1,
|
"cost": 1.1752,
|
"chosen": true
|
}
|
],
|
"analyzing_roworder_intersect":
|
{
|
"cause": "too few roworder scans"
|
},
|
"analyzing_index_merge_union":
|
[
|
]
|
}
|
]
|
Things to note:
- empty lines at the start (right before/after the "range_scan_alternatives")
- "analyzing_index_merge_union":[] occupies 3 lines where one would be sufficient.
- the same goes for "ranges"
One can look at the JSON pretty-printer that is used by EXPLAIN FORMAT=JSON and optimizer trace. It produces a better result (but it has room for improvement, too.)
Extra: in MySQL, the function is called JSON_PRETTY. We should add ability to use this name as an alias.
Attachments
Issue Links
- is part of
-
MDEV-28906 MySQL 8.0 desired compatibility
-
- Open
-
- relates to
-
MDEV-6111 optimizer trace
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
JSON_DETAILED function (https://mariadb.com/kb/en/library/json_detailed/ ) is described as
{noformat} Represents JSON in the most understandable way emphasizing nested structures. {noformat} We now got a use case for it: Optimizer Trace output. Optimizer trace is too large to be copied in full, instead we use expressions like {noformat} select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; {noformat} Our experience is that {{JSON_DETAILED}} has some room for improvement when it comes to the quality of automatic JSON formatting. Example: |
JSON_DETAILED function (https://mariadb.com/kb/en/library/json_detailed/ ) is described as
{noformat} Represents JSON in the most understandable way emphasizing nested structures. {noformat} We now got a use case for it: Optimizer Trace output. Optimizer trace is too large to be copied in full, instead we use expressions like {noformat} select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; {noformat} Our experience is that {{JSON_DETAILED}} has some room for improvement when it comes to the quality of automatic JSON formatting. Example: {code} source mdev19160-data.sql mysql> select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200\G *************************** 1. row *************************** JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')): [ { "range_scan_alternatives": [ { "index": "a_b", "ranges": [ "2 <= a <= 2 AND 4 <= b <= 4" ], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true } ], "analyzing_roworder_intersect": { "cause": "too few roworder scans" }, "analyzing_index_merge_union": [ ] } ] {code} Things to note: * empty lines at the start * {{"analyzing_index_merge_union":[]}} occupies 3 lines where one would be sufficient. * the same goes for "ranges" One can look at JSON pretty-printer that EXPLAIN FORMAT=JSON and optimizer trace use. It produces a better result. Perhaps, we should switch JSON_DETAILED to use it? |
Description |
JSON_DETAILED function (https://mariadb.com/kb/en/library/json_detailed/ ) is described as
{noformat} Represents JSON in the most understandable way emphasizing nested structures. {noformat} We now got a use case for it: Optimizer Trace output. Optimizer trace is too large to be copied in full, instead we use expressions like {noformat} select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; {noformat} Our experience is that {{JSON_DETAILED}} has some room for improvement when it comes to the quality of automatic JSON formatting. Example: {code} source mdev19160-data.sql mysql> select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200\G *************************** 1. row *************************** JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')): [ { "range_scan_alternatives": [ { "index": "a_b", "ranges": [ "2 <= a <= 2 AND 4 <= b <= 4" ], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true } ], "analyzing_roworder_intersect": { "cause": "too few roworder scans" }, "analyzing_index_merge_union": [ ] } ] {code} Things to note: * empty lines at the start * {{"analyzing_index_merge_union":[]}} occupies 3 lines where one would be sufficient. * the same goes for "ranges" One can look at JSON pretty-printer that EXPLAIN FORMAT=JSON and optimizer trace use. It produces a better result. Perhaps, we should switch JSON_DETAILED to use it? |
JSON_DETAILED function (https://mariadb.com/kb/en/library/json_detailed/ ) is described as
{noformat} Represents JSON in the most understandable way emphasizing nested structures. {noformat} We now got a use case for it: Optimizer Trace output. Optimizer trace is too large to be copied in full, instead we use expressions like {noformat} select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; {noformat} Our experience is that {{JSON_DETAILED}} has some room for improvement when it comes to the quality of automatic JSON formatting. Example: {code} source mdev19160-data.sql mysql> select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200\G *************************** 1. row *************************** JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')): [ { "range_scan_alternatives": [ { "index": "a_b", "ranges": [ "2 <= a <= 2 AND 4 <= b <= 4" ], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true } ], "analyzing_roworder_intersect": { "cause": "too few roworder scans" }, "analyzing_index_merge_union": [ ] } ] {code} Things to note: * empty lines at the start (right before/after the "range_scan_alternatives") * {{"analyzing_index_merge_union":[]}} occupies 3 lines where one would be sufficient. * the same goes for "ranges" One can look at JSON pretty-printer that EXPLAIN FORMAT=JSON and optimizer trace use. It produces a better result. Perhaps, we should switch JSON_DETAILED to use it? |
Attachment | mdev19160-data.sql [ 47904 ] |
Fix Version/s | 10.4 [ 22408 ] |
Assignee | Varun Gupta [ varun ] |
Summary | DRAFT JSON_DETAILED output unnecessarily verbose | JSON_DETAILED output unnecessarily verbose |
Description |
JSON_DETAILED function (https://mariadb.com/kb/en/library/json_detailed/ ) is described as
{noformat} Represents JSON in the most understandable way emphasizing nested structures. {noformat} We now got a use case for it: Optimizer Trace output. Optimizer trace is too large to be copied in full, instead we use expressions like {noformat} select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; {noformat} Our experience is that {{JSON_DETAILED}} has some room for improvement when it comes to the quality of automatic JSON formatting. Example: {code} source mdev19160-data.sql mysql> select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200\G *************************** 1. row *************************** JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')): [ { "range_scan_alternatives": [ { "index": "a_b", "ranges": [ "2 <= a <= 2 AND 4 <= b <= 4" ], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true } ], "analyzing_roworder_intersect": { "cause": "too few roworder scans" }, "analyzing_index_merge_union": [ ] } ] {code} Things to note: * empty lines at the start (right before/after the "range_scan_alternatives") * {{"analyzing_index_merge_union":[]}} occupies 3 lines where one would be sufficient. * the same goes for "ranges" One can look at JSON pretty-printer that EXPLAIN FORMAT=JSON and optimizer trace use. It produces a better result. Perhaps, we should switch JSON_DETAILED to use it? |
JSON_DETAILED function (https://mariadb.com/kb/en/library/json_detailed/ ) is described as
{noformat} Represents JSON in the most understandable way emphasizing nested structures. {noformat} We now got a use case for it: Optimizer Trace output. Optimizer trace is too large to be copied in full, instead we use expressions like {noformat} select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; {noformat} Our experience is that {{JSON_DETAILED}} has some room for improvement when it comes to the quality of automatic JSON formatting. Example: {code} source mdev19160-data.sql mysql> select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200\G *************************** 1. row *************************** JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')): [ { "range_scan_alternatives": [ { "index": "a_b", "ranges": [ "2 <= a <= 2 AND 4 <= b <= 4" ], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true } ], "analyzing_roworder_intersect": { "cause": "too few roworder scans" }, "analyzing_index_merge_union": [ ] } ] {code} Things to note: * empty lines at the start (right before/after the "range_scan_alternatives") * {{"analyzing_index_merge_union":[]}} occupies 3 lines where one would be sufficient. * the same goes for "ranges" One can look at the JSON pretty-printer that is used by EXPLAIN FORMAT=JSON and optimizer trace. It produces a better result (but it has room for improvement, too.) Perhaps, we should switch JSON_DETAILED to use it? |
Description |
JSON_DETAILED function (https://mariadb.com/kb/en/library/json_detailed/ ) is described as
{noformat} Represents JSON in the most understandable way emphasizing nested structures. {noformat} We now got a use case for it: Optimizer Trace output. Optimizer trace is too large to be copied in full, instead we use expressions like {noformat} select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; {noformat} Our experience is that {{JSON_DETAILED}} has some room for improvement when it comes to the quality of automatic JSON formatting. Example: {code} source mdev19160-data.sql mysql> select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200\G *************************** 1. row *************************** JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')): [ { "range_scan_alternatives": [ { "index": "a_b", "ranges": [ "2 <= a <= 2 AND 4 <= b <= 4" ], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true } ], "analyzing_roworder_intersect": { "cause": "too few roworder scans" }, "analyzing_index_merge_union": [ ] } ] {code} Things to note: * empty lines at the start (right before/after the "range_scan_alternatives") * {{"analyzing_index_merge_union":[]}} occupies 3 lines where one would be sufficient. * the same goes for "ranges" One can look at the JSON pretty-printer that is used by EXPLAIN FORMAT=JSON and optimizer trace. It produces a better result (but it has room for improvement, too.) Perhaps, we should switch JSON_DETAILED to use it? |
JSON_DETAILED function (https://mariadb.com/kb/en/library/json_detailed/ ) is described as
{noformat} Represents JSON in the most understandable way emphasizing nested structures. {noformat} We now got a use case for it: Optimizer Trace output. Optimizer trace is too large to be copied in full, instead we use expressions like {noformat} select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; {noformat} Our experience is that {{JSON_DETAILED}} has some room for improvement when it comes to the quality of automatic JSON formatting. Example: {code} source mdev19160-data.sql mysql> select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200\G *************************** 1. row *************************** JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')): [ { "range_scan_alternatives": [ { "index": "a_b", "ranges": [ "2 <= a <= 2 AND 4 <= b <= 4" ], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true } ], "analyzing_roworder_intersect": { "cause": "too few roworder scans" }, "analyzing_index_merge_union": [ ] } ] {code} Things to note: * empty lines at the start (right before/after the "range_scan_alternatives") * {{"analyzing_index_merge_union":[]}} occupies 3 lines where one would be sufficient. * the same goes for "ranges" One can look at the JSON pretty-printer that is used by EXPLAIN FORMAT=JSON and optimizer trace. It produces a better result (but it has room for improvement, too.) Extra: in MySQL, the function is called JSON_PRETTY. We should add ability to use this name as an alias. |
Labels | gsoc21 |
Assignee | Varun Gupta [ varun ] | Sergei Petrunia [ psergey ] |
Labels | gsoc21 | beginner-friendly gsoc21 |
Labels | beginner-friendly gsoc21 | beginner-friendly gsoc21 optimizer |
Assignee | Sergei Petrunia [ psergey ] | Sergei Krivonos [ JIRAUSER49805 ] |
Workflow | MariaDB v3 [ 94219 ] | MariaDB v4 [ 141237 ] |
Assignee | Sergei Krivonos [ JIRAUSER49805 ] |
Labels | beginner-friendly gsoc21 optimizer | beginner-friendly gsoc21 gsoc22 optimizer |
Summary | JSON_DETAILED output unnecessarily verbose | JSON_DETAILED output unnecessarily verbose (Part Time project) |
Comment |
[ Hello! @Sergei Golubchik I am Tan Ziyi from Huazhong University of Science and Technology (HUST, China),
a 1st computer graduate student I want to work on this issue Please guide me how to start working, looking forward to your reply! (I am trying to build this project) ] |
Assignee | Rucha Deodhar [ rucha174 ] |
Fix Version/s | 10.4.28 [ 28509 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Link | This issue is part of MDEV-28906 [ MDEV-28906 ] |
Fix Version/s | 10.6.12 [ 28513 ] | |
Fix Version/s | 10.5.19 [ 28511 ] |
cc: holyfoot