1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Make tests work with --view-protocol

This commit is contained in:
Sergei Petrunia
2022-12-16 13:33:05 +03:00
parent 1529881595
commit e4fbec1463
7 changed files with 276 additions and 188 deletions

View File

@ -29,81 +29,86 @@ set optimizer_trace="enabled=on";
select count(*) from t1 where a=2 and b=5 and c=10;
count(*)
14
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
set @trace=(select trace from INFORMATION_SCHEMA.OPTIMIZER_TRACE);
select
JSON_DETAILED(
JSON_EXTRACT(
JSON_EXTRACT(@trace, '$**.considered_execution_plans'),
'$[0]'
)
) as JS;
JS
[
[
{
"plan_prefix": "",
"get_costs_for_tables":
[
{
"plan_prefix": "",
"get_costs_for_tables":
[
{
"best_access_path":
{
"best_access_path":
"table": "t1",
"plan_details":
{
"table": "t1",
"plan_details":
"record_count": 1
},
"considered_access_paths":
[
{
"record_count": 1
"access_type": "ref",
"index": "a",
"used_range_estimates": true,
"rows": 104,
"cost": 0.060906438,
"chosen": true
},
"considered_access_paths":
[
{
"access_type": "ref",
"index": "a",
"used_range_estimates": true,
"rows": 104,
"cost": 0.060906438,
"chosen": true
},
{
"access_type": "ref",
"index": "b",
"used_range_estimates": true,
"rows": 340,
"cost": 0.14153631,
"chosen": false,
"cause": "cost"
},
{
"access_type": "ref",
"index": "c",
"used_range_estimates": true,
"rows": 632,
"cost": 0.241743894,
"chosen": false,
"cause": "cost"
},
{
"access_type": "index_merge",
"rows": 7,
"rows_after_filter": 7,
"rows_out": 7,
"cost": 0.045367017,
"chosen": true
}
],
"chosen_access_method":
{
"type": "index_merge",
"rows_read": 7,
"access_type": "ref",
"index": "b",
"used_range_estimates": true,
"rows": 340,
"cost": 0.14153631,
"chosen": false,
"cause": "cost"
},
{
"access_type": "ref",
"index": "c",
"used_range_estimates": true,
"rows": 632,
"cost": 0.241743894,
"chosen": false,
"cause": "cost"
},
{
"access_type": "index_merge",
"rows": 7,
"rows_after_filter": 7,
"rows_out": 7,
"cost": 0.045367017,
"uses_join_buffering": false
"chosen": true
}
],
"chosen_access_method":
{
"type": "index_merge",
"rows_read": 7,
"rows_out": 7,
"cost": 0.045367017,
"uses_join_buffering": false
}
}
]
},
{
"plan_prefix": "",
"table": "t1",
"rows_for_plan": 7,
"cost_for_plan": 0.045367017
}
]
}
]
},
{
"plan_prefix": "",
"table": "t1",
"rows_for_plan": 7,
"cost_for_plan": 0.045367017
}
]
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select JSON_DETAILED(JSON_EXTRACT(@trace, '$**.selectivity_for_indexes')) as JS;
JS
[
[
{
@ -122,81 +127,86 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select count(*) from t1 where a=2 and b=5 and c=5;
count(*)
3
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
set @trace=(select trace from INFORMATION_SCHEMA.OPTIMIZER_TRACE);
select
JSON_DETAILED(
JSON_EXTRACT(
JSON_EXTRACT(@trace, '$**.considered_execution_plans'),
'$[0]'
)
) as JS;
JS
[
[
{
"plan_prefix": "",
"get_costs_for_tables":
[
{
"plan_prefix": "",
"get_costs_for_tables":
[
{
"best_access_path":
{
"best_access_path":
"table": "t1",
"plan_details":
{
"table": "t1",
"plan_details":
"record_count": 1
},
"considered_access_paths":
[
{
"record_count": 1
},
"considered_access_paths":
[
{
"access_type": "ref",
"index": "a",
"used_range_estimates": true,
"rows": 6,
"cost": 0.005306142,
"chosen": true
},
{
"access_type": "ref",
"index": "b",
"used_range_estimates": true,
"rows": 232,
"cost": 0.104637894,
"chosen": false,
"cause": "cost"
},
{
"access_type": "ref",
"index": "c",
"used_range_estimates": true,
"rows": 293,
"cost": 0.125478666,
"chosen": false,
"cause": "cost"
},
{
"type": "scan",
"chosen": false,
"cause": "cost"
}
],
"chosen_access_method":
{
"type": "ref",
"rows_read": 6,
"rows_out": 0.6,
"access_type": "ref",
"index": "a",
"used_range_estimates": true,
"rows": 6,
"cost": 0.005306142,
"uses_join_buffering": false
"chosen": true
},
{
"access_type": "ref",
"index": "b",
"used_range_estimates": true,
"rows": 232,
"cost": 0.104637894,
"chosen": false,
"cause": "cost"
},
{
"access_type": "ref",
"index": "c",
"used_range_estimates": true,
"rows": 293,
"cost": 0.125478666,
"chosen": false,
"cause": "cost"
},
{
"type": "scan",
"chosen": false,
"cause": "cost"
}
],
"chosen_access_method":
{
"type": "ref",
"rows_read": 6,
"rows_out": 0.6,
"cost": 0.005306142,
"uses_join_buffering": false
}
}
]
},
{
"plan_prefix": "",
"table": "t1",
"rows_for_plan": 0.6,
"cost_for_plan": 0.005306142,
"pushdown_cond_selectivity": 0.1,
"filtered": 10,
"rows_out": 0.6
}
]
}
]
},
{
"plan_prefix": "",
"table": "t1",
"rows_for_plan": 0.6,
"cost_for_plan": 0.005306142,
"pushdown_cond_selectivity": 0.1,
"filtered": 10,
"rows_out": 0.6
}
]
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select JSON_DETAILED(JSON_EXTRACT(@trace, '$**.selectivity_for_indexes')) as JS;
JS
[
[
{
@ -213,8 +223,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select count(*) from t1 where (a=2 and b= 5);
count(*)
20
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JS
[
[
{
@ -231,8 +242,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select count(*) from t1 where (a=2 and b between 0 and 100);
count(*)
200
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JS
[
[
{
@ -248,8 +260,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select count(*) from t1 where (a in (2,3) and b between 0 and 100);
count(*)
400
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JS
[
[
{
@ -265,8 +278,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select count(*) from t1 where (a>2 and b between 0 and 100);
count(*)
10702
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JS
[
[
{
@ -282,8 +296,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select count(*) from t1 where (a>=2 and b between 0 and 100);
count(*)
10902
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JS
[
[
{
@ -299,8 +314,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select count(*) from t1 where (a<=2 and b between 0 and 100);
count(*)
298
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JS
[
[
{
@ -316,8 +332,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select count(*) from t1 where (a<2 and b between 0 and 100);
count(*)
98
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JS
[
[
{
@ -333,8 +350,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select count(*) from t1 where (a between 2 and 3 and b between 0 and 100);
count(*)
400
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
JS
[
[
{