Skip to content
/ server Public
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions mysql-test/include/get_names_ddls_from_opt_ctx.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
set @opt_context=
(select REGEXP_SUBSTR(
context,
'(?<=set @opt_context=\')([\n\r].*)*(?=\'\;--opt_context_ends)')
from information_schema.optimizer_context);
set @ddls= (select REGEXP_SUBSTR(
context, '(CREATE.*)([\n\r].*)*(?=(set @opt|REPLACE INTO))')
AS ddl from information_schema.optimizer_context);
set @db=
(select JSON_DETAILED(JSON_EXTRACT(@opt_context, '$**.current_database')));
select db_used from json_table(@db,
'$[*]' columns(db_used text path '$')) as jt;
set @fn= (select JSON_DETAILED(JSON_EXTRACT(@opt_context, '$**.name')));
select name from json_table(@fn, '$[*]' columns(name text path '$')) as jt;
select @ddls;
7 changes: 7 additions & 0 deletions mysql-test/include/get_opt_context.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set @opt_context=
(select REGEXP_SUBSTR(
context,
'(?<=set @opt_context=\')([\n\r].*)*(?=\'\;--opt_context_ends)'
)
from information_schema.optimizer_context
);
23 changes: 23 additions & 0 deletions mysql-test/include/get_rec_idx_ranges_from_opt_ctx.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
set @opt_context=
(select REGEXP_SUBSTR(
context,
'(?<=set @opt_context=\')([\n\r].*)*(?=\'\;--opt_context_ends)')
from information_schema.optimizer_context);
set @records=
(select JSON_DETAILED(JSON_EXTRACT(@opt_context, '$**.num_of_records')));
select *from json_table(@records,
'$[*]' columns(num_of_records text path '$')) as jt;
set @indexes=
(select JSON_DETAILED(JSON_EXTRACT(@opt_context, '$**.indexes')));
select *from json_table(
@indexes, '$[*][*]' columns(index_name text path '$.index_name',
rec_per_key json path '$.rec_per_key')) as jt;
set @list_ranges=
(select JSON_DETAILED(JSON_EXTRACT(@opt_context, '$**.list_ranges')));
select *from json_table(
@list_ranges,
'$[*][*]' columns(index_name text path '$.index_name',
ranges json path '$.ranges',
num_rows int path '$.num_rows',
max_index_blocks int path '$.max_index_blocks',
max_row_blocks int path '$.max_row_blocks')) as jt;
10 changes: 4 additions & 6 deletions mysql-test/include/run_query_twice_and_compare_stats.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ set optimizer_replay_context="";
echo $explain_query;
let $explain_output=`$explain_query`;

set @trace= (select trace from information_schema.optimizer_trace);
set @saved_opt_context=
(select json_pretty(json_extract(
json_extract(@trace, "$**.optimizer_context"),
'$[0]'
)
));
(select REGEXP_SUBSTR(
context,
'(?<=set @opt_context=\')([\n\r].*)*(?=\'\;--opt_context_ends)')
from information_schema.optimizer_context);
set @saved_opt_context_var_name='saved_opt_context';

#TO-DO: enable it after MDEV-38033 is resolved
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/main/information_schema-big.result
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ KEYWORDS WORD
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
KEY_PERIOD_USAGE CONSTRAINT_SCHEMA
OPTIMIZER_CONTEXT QUERY
OPTIMIZER_COSTS ENGINE
PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
Expand Down Expand Up @@ -105,6 +106,7 @@ KEYWORDS WORD
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
KEY_PERIOD_USAGE CONSTRAINT_SCHEMA
OPTIMIZER_CONTEXT QUERY
OPTIMIZER_COSTS ENGINE
PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/main/information_schema-big_embedded.result
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ KEYWORDS WORD
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
KEY_PERIOD_USAGE CONSTRAINT_SCHEMA
OPTIMIZER_CONTEXT QUERY
OPTIMIZER_COSTS ENGINE
PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
Expand Down Expand Up @@ -104,6 +105,7 @@ KEYWORDS WORD
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
KEY_PERIOD_USAGE CONSTRAINT_SCHEMA
OPTIMIZER_CONTEXT QUERY
OPTIMIZER_COSTS ENGINE
PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/main/information_schema.result
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ KEYWORDS
KEY_CACHES
KEY_COLUMN_USAGE
KEY_PERIOD_USAGE
OPTIMIZER_CONTEXT
OPTIMIZER_COSTS
OPTIMIZER_TRACE
PARAMETERS
Expand Down Expand Up @@ -897,6 +898,8 @@ information_schema COLUMNS COLUMN_DEFAULT
information_schema COLUMNS COLUMN_TYPE
information_schema COLUMNS GENERATION_EXPRESSION
information_schema EVENTS EVENT_DEFINITION
information_schema OPTIMIZER_CONTEXT QUERY
information_schema OPTIMIZER_CONTEXT CONTEXT
information_schema OPTIMIZER_TRACE QUERY
information_schema OPTIMIZER_TRACE TRACE
information_schema PARAMETERS DTD_IDENTIFIER
Expand Down
7 changes: 6 additions & 1 deletion mysql-test/main/information_schema_all_engines.result
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ KEYWORDS
KEY_CACHES
KEY_COLUMN_USAGE
KEY_PERIOD_USAGE
OPTIMIZER_CONTEXT
OPTIMIZER_COSTS
OPTIMIZER_TRACE
PARAMETERS
Expand Down Expand Up @@ -131,6 +132,7 @@ KEYWORDS WORD
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
KEY_PERIOD_USAGE CONSTRAINT_SCHEMA
OPTIMIZER_CONTEXT QUERY
OPTIMIZER_COSTS ENGINE
OPTIMIZER_TRACE QUERY
PARAMETERS SPECIFIC_SCHEMA
Expand Down Expand Up @@ -219,6 +221,7 @@ KEYWORDS WORD
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
KEY_PERIOD_USAGE CONSTRAINT_SCHEMA
OPTIMIZER_CONTEXT QUERY
OPTIMIZER_COSTS ENGINE
OPTIMIZER_TRACE QUERY
PARAMETERS SPECIFIC_SCHEMA
Expand Down Expand Up @@ -384,6 +387,7 @@ Database: information_schema
| KEY_CACHES |
| KEY_COLUMN_USAGE |
| KEY_PERIOD_USAGE |
| OPTIMIZER_CONTEXT |
| OPTIMIZER_COSTS |
| OPTIMIZER_TRACE |
| PARAMETERS |
Expand Down Expand Up @@ -462,6 +466,7 @@ Database: INFORMATION_SCHEMA
| KEY_CACHES |
| KEY_COLUMN_USAGE |
| KEY_PERIOD_USAGE |
| OPTIMIZER_CONTEXT |
| OPTIMIZER_COSTS |
| OPTIMIZER_TRACE |
| PARAMETERS |
Expand Down Expand Up @@ -501,5 +506,5 @@ Wildcard: inf_rmation_schema
| information_schema |
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 73
information_schema 74
mysql 31
Loading