2
SHOW TABLES LIKE 'innodb%';
3
Tables_in_data_dictionary (innodb%)
9
INNODB_SYS_FOREIGN_COLS
12
innodb_table_definitions
13
show create table data_dictionary.innodb_sys_tables;
15
innodb_sys_tables CREATE TABLE `innodb_sys_tables` (
16
`NAME` VARBINARY(192),
20
`MIX_ID` VARBINARY(192),
22
`CLUSTER_NAME` VARBINARY(192),
24
PRIMARY KEY (`NAME`) USING BTREE
25
) ENGINE=InnoDB COLLATE = binary
26
show create table data_dictionary.innodb_sys_columns;
28
innodb_sys_columns CREATE TABLE `innodb_sys_columns` (
31
`NAME` VARBINARY(192),
36
PRIMARY KEY (`TABLE_ID`,`POS`) USING BTREE
37
) ENGINE=InnoDB COLLATE = binary
38
show create table data_dictionary.innodb_sys_indexes;
40
innodb_sys_indexes CREATE TABLE `innodb_sys_indexes` (
43
`NAME` VARBINARY(192),
48
PRIMARY KEY (`TABLE_ID`,`ID`) USING BTREE
49
) ENGINE=InnoDB COLLATE = binary
50
show create table data_dictionary.innodb_sys_fields;
52
innodb_sys_fields CREATE TABLE `innodb_sys_fields` (
55
`COL_NAME` VARBINARY(192),
56
PRIMARY KEY (`INDEX_ID`,`POS`) USING BTREE
57
) ENGINE=InnoDB COLLATE = binary
58
show create table data_dictionary.innodb_sys_foreign;
60
innodb_sys_foreign CREATE TABLE `innodb_sys_foreign` (
62
`FOR_NAME` VARBINARY(192),
63
`REF_NAME` VARBINARY(192),
65
PRIMARY KEY (`ID`) USING BTREE,
66
KEY `FOR_IND` (`FOR_NAME`) USING BTREE,
67
KEY `REF_IND` (`REF_NAME`) USING BTREE
68
) ENGINE=InnoDB COLLATE = binary
69
show create table data_dictionary.innodb_sys_foreign_cols;
71
innodb_sys_foreign_cols CREATE TABLE `innodb_sys_foreign_cols` (
74
`FOR_COL_NAME` VARBINARY(192),
75
`REF_COL_NAME` VARBINARY(192),
76
PRIMARY KEY (`ID`,`POS`) USING BTREE
77
) ENGINE=InnoDB COLLATE = binary
78
select name from data_dictionary.innodb_sys_tables;
82
data_dictionary/innodb_table_definitions
83
explain select name from data_dictionary.innodb_sys_tables where name="SYS_FOREIGN";
84
id select_type table type possible_keys key key_len ref rows Extra
85
1 SIMPLE innodb_sys_tables const PRIMARY PRIMARY 195 const 1 Using index
86
select name from data_dictionary.innodb_sys_tables where name="SYS_FOREIGN";
89
select t.name t,c.name c from data_dictionary.innodb_sys_tables as t, data_dictionary.innodb_sys_columns as c where t.id=c.table_id;
97
SYS_FOREIGN_COLS FOR_COL_NAME
98
SYS_FOREIGN_COLS REF_COL_NAME
99
data_dictionary/innodb_table_definitions table_name
100
data_dictionary/innodb_table_definitions message
101
select t.name as table_name,c.name as column_name from data_dictionary.innodb_sys_tables t,data_dictionary.innodb_sys_columns c where t.id=c.table_id order by table_name,column_name;
102
table_name column_name
107
SYS_FOREIGN_COLS FOR_COL_NAME
110
SYS_FOREIGN_COLS REF_COL_NAME
111
data_dictionary/innodb_table_definitions message
112
data_dictionary/innodb_table_definitions table_name
113
create table test.t1 (a int primary key, b int, c int, index(b), index(c), index(b,c));
114
select name,n_fields from data_dictionary.innodb_sys_indexes i where i.table_id=(select id from data_dictionary.innodb_sys_tables where name="test/t1");
120
select f.col_name from data_dictionary.innodb_sys_fields f where f.index_id in (select id from data_dictionary.innodb_sys_indexes i where i.table_id=(select id from data_dictionary.innodb_sys_tables where name="test/t1"));