TABLE_ID	NAME	FLAG	N_COLS	SPACE	FILE_FORMAT	ROW_FORMAT	ZIP_PAGE_SIZE	SPACE_TYPE
11	SYS_FOREIGN	0	7	0	Antelope	Redundant	0	System
12	SYS_FOREIGN_COLS	0	7	0	Antelope	Redundant	0	System
13	SYS_TABLESPACES	0	6	0	Antelope	Redundant	0	System
14	SYS_DATAFILES	0	5	0	Antelope	Redundant	0	System
15	SYS_VIRTUAL	0	6	0	Antelope	Redundant	0	System
16	SYS_ZIP_DICT	0	6	0	Antelope	Redundant	0	System
17	SYS_ZIP_DICT_COLS	0	6	0	Antelope	Redundant	0	System
18	mysql/plugin	33	5	2	Barracuda	Dynamic	0	Single
19	mysql/servers	33	12	3	Barracuda	Dynamic	0	Single
20	mysql/help_topic	33	9	4	Barracuda	Dynamic	0	Single
21	mysql/help_category	33	7	5	Barracuda	Dynamic	0	Single
22	mysql/help_relation	33	5	6	Barracuda	Dynamic	0	Single
23	mysql/help_keyword	33	5	7	Barracuda	Dynamic	0	Single
24	mysql/time_zone_name	33	5	8	Barracuda	Dynamic	0	Single
25	mysql/time_zone	33	5	9	Barracuda	Dynamic	0	Single
26	mysql/time_zone_transition	33	6	10	Barracuda	Dynamic	0	Single
27	mysql/time_zone_transition_type	33	8	11	Barracuda	Dynamic	0	Single
28	mysql/time_zone_leap_second	33	5	12	Barracuda	Dynamic	0	Single
34	mysql/gtid_executed	33	6	18	Barracuda	Dynamic	0	Single
35	mysql/server_cost	33	7	19	Barracuda	Dynamic	0	Single
36	mysql/engine_cost	33	9	20	Barracuda	Dynamic	0	Single
table_id	pos	mtype	prtype	len	name
11	0	1	524292	0	ID
11	1	1	524292	0	FOR_NAME
11	2	1	524292	0	REF_NAME
11	3	6	0	4	N_COLS
12	0	1	524292	0	ID
12	1	6	0	4	POS
12	2	1	524292	0	FOR_COL_NAME
12	3	1	524292	0	REF_COL_NAME
13	0	6	0	4	SPACE
13	1	1	524292	0	NAME
13	2	6	0	4	FLAGS
14	0	6	0	4	SPACE
14	1	1	524292	0	PATH
15	0	6	0	8	TABLE_ID
15	1	6	0	4	POS
15	2	6	0	4	BASE_POS
16	0	6	768	4	ID
16	1	1	524548	64	NAME
16	2	5	4130048	0	DATA
17	0	6	768	4	TABLE_ID
17	1	6	768	4	COLUMN_POS
17	2	6	768	4	DICT_ID
18	0	12	2162959	192	name
18	1	12	2167055	384	dl
19	0	13	2163198	192	Server_name
19	1	13	2163198	192	Host
19	2	13	2163198	192	Db
19	3	13	2163198	192	Username
19	4	13	2163198	192	Password
19	5	6	1283	4	Port
19	6	13	2163198	192	Socket
19	7	13	2163198	192	Wrapper
19	8	13	2163198	192	Owner
20	0	6	1795	4	help_topic_id
20	1	13	2163198	192	name
20	2	6	1794	2	help_category_id
20	3	5	2163196	10	description
20	4	5	2163196	10	example
20	5	5	2163196	10	url
21	0	6	1794	2	help_category_id
21	1	13	2163198	192	name
21	2	6	1538	2	parent_category_id
21	3	5	2163196	10	url
22	0	6	1795	4	help_topic_id
22	1	6	1795	4	help_keyword_id
23	0	6	1795	4	help_keyword_id
23	1	13	2163198	192	name
24	0	13	2163198	192	Name
24	1	6	1795	4	Time_zone_id
25	0	6	1795	4	Time_zone_id
25	1	6	1022	1	Use_leap_seconds
26	0	6	1795	4	Time_zone_id
26	1	6	1288	8	Transition_time
26	2	6	1795	4	Transition_type_id
27	0	6	1795	4	Time_zone_id
27	1	6	1795	4	Transition_type_id
27	2	6	1283	4	Offset
27	3	6	1793	1	Is_DST
27	4	13	2163198	24	Abbreviation
28	0	6	1288	8	Transition_time
28	1	6	1283	4	Correction
34	0	2	524798	36	source_uuid
34	1	6	1288	8	interval_start
34	2	6	1288	8	interval_end
35	0	12	2162959	192	cost_name
35	1	9	1028	4	cost_value
35	2	3	525575	4	last_update
35	3	12	2166799	3072	comment
36	0	12	2162959	192	engine_name
36	1	6	1283	4	device_type
36	2	12	2162959	192	cost_name
36	3	9	1028	4	cost_value
36	4	3	525575	4	last_update
36	5	12	2166799	3072	comment
index_id	table_id	type	n_fields	space	name
11	11	3	1	0	ID_IND
12	11	0	1	0	FOR_IND
13	11	0	1	0	REF_IND
14	12	3	2	0	ID_IND
15	13	3	1	0	SYS_TABLESPACES_SPACE
16	14	3	1	0	SYS_DATAFILES_SPACE
17	15	3	3	0	BASE_IDX
18	16	3	1	0	SYS_ZIP_DICT_ID
19	16	2	1	0	SYS_ZIP_DICT_NAME
20	17	3	2	0	SYS_ZIP_DICT_COLS_COMPOSITE
21	18	3	1	2	PRIMARY
22	19	3	1	3	PRIMARY
23	20	3	1	4	PRIMARY
24	20	2	1	4	name
25	21	3	1	5	PRIMARY
26	21	2	1	5	name
27	22	3	2	6	PRIMARY
28	23	3	1	7	PRIMARY
29	23	2	1	7	name
30	24	3	1	8	PRIMARY
31	25	3	1	9	PRIMARY
32	26	3	2	10	PRIMARY
33	27	3	2	11	PRIMARY
34	28	3	1	12	PRIMARY
40	34	3	2	18	PRIMARY
41	35	3	1	19	PRIMARY
42	36	3	3	20	PRIMARY
SELECT index_id,pos,name FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS
WHERE name NOT IN ('database_name', 'table_name', 'index_name', 'stat_name', 'id', 'host', 'port', 'variable')
ORDER BY index_id, pos;
index_id	pos	name
12	0	FOR_NAME
13	0	REF_NAME
14	1	POS
15	0	SPACE
16	0	SPACE
17	0	TABLE_ID
17	1	POS
17	2	BASE_POS
19	0	NAME
20	0	TABLE_ID
20	1	COLUMN_POS
21	0	name
22	0	Server_name
23	0	help_topic_id
24	0	name
25	0	help_category_id
26	0	name
27	0	help_keyword_id
27	1	help_topic_id
28	0	help_keyword_id
29	0	name
30	0	Name
31	0	Time_zone_id
32	0	Time_zone_id
32	1	Transition_time
33	0	Time_zone_id
33	1	Transition_type_id
34	0	Transition_time
37	0	Channel_name
38	0	Channel_name
39	0	Channel_name
40	0	source_uuid
40	1	interval_start
41	0	cost_name
42	0	cost_name
42	1	engine_name
42	2	device_type
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID	FOR_NAME	REF_NAME	N_COLS	TYPE
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID	FOR_COL_NAME	REF_COL_NAME	POS
DROP TABLE IF EXISTS t_redundant, t_compact, t_compressed, t_dynamic;
CREATE TABLE t_redundant (a INT KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=innodb;
CREATE TABLE t_compact (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb;
CREATE TABLE t_compressed (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb KEY_BLOCK_SIZE=2;
CREATE TABLE t_dynamic (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb;
=== information_schema.innodb_sys_tables  and innodb_sys_tablespaces ===
Table Name	Tablespace	Table Flags	Columns	Row Format	Zip Size	Space Type
test/t_compact	test/t_compact	1	5	Compact	0	Single
test/t_compressed	test/t_compressed	37	5	Compressed	2048	Single
test/t_dynamic	test/t_dynamic	33	5	Dynamic	0	Single
test/t_redundant	test/t_redundant	0	5	Redundant	0	Single
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name	Space_Type	Page_Size	Zip_Size	Formats_Permitted	Path
test/t_redundant	Single	DEFAULT	0	Compact or Redundant	MYSQLD_DATADIR/test/t_redundant.ibd
test/t_compact	Single	DEFAULT	0	Compact or Redundant	MYSQLD_DATADIR/test/t_compact.ibd
test/t_compressed	Single	DEFAULT	2048	Compressed	MYSQLD_DATADIR/test/t_compressed.ibd
test/t_dynamic	Single	DEFAULT	0	Dynamic	MYSQLD_DATADIR/test/t_dynamic.ibd
=== information_schema.files ===
Space_Name	File_Type	Engine	Status	Tablespace_Name	Path
test/t_redundant	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQLD_DATADIR/test/t_redundant.ibd
test/t_compact	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQLD_DATADIR/test/t_compact.ibd
test/t_compressed	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQLD_DATADIR/test/t_compressed.ibd
test/t_dynamic	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQLD_DATADIR/test/t_dynamic.ibd
DROP TABLE t_redundant, t_compact, t_compressed, t_dynamic;
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name NOT LIKE 'sys/%';
count(*)
26
CREATE TABLE parent (id INT NOT NULL,
PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID	FOR_NAME	REF_NAME	N_COLS	TYPE
test/constraint_test	test/child	test/parent	1	1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID	FOR_COL_NAME	REF_COL_NAME	POS
test/constraint_test	parent_id	id	0
INSERT INTO parent VALUES(1);
SELECT name, num_rows, ref_count
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
name	num_rows	ref_count
test/parent	1	1
SELECT NAME, FLAG, N_COLS FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name NOT LIKE 'sys/%';
NAME	FLAG	N_COLS
SYS_DATAFILES	0	5
SYS_FOREIGN	0	7
SYS_FOREIGN_COLS	0	7
SYS_TABLESPACES	0	6
SYS_VIRTUAL	0	6
SYS_ZIP_DICT	0	6
SYS_ZIP_DICT_COLS	0	6
mysql/engine_cost	33	9
mysql/gtid_executed	33	6
mysql/help_category	33	7
mysql/help_keyword	33	5
mysql/help_relation	33	5
mysql/help_topic	33	9
mysql/innodb_index_stats	33	11
mysql/innodb_table_stats	33	9
mysql/plugin	33	5
mysql/server_cost	33	7
mysql/servers	33	12
mysql/slave_master_info	33	28
mysql/slave_relay_log_info	33	12
mysql/slave_worker_info	33	16
mysql/time_zone	33	5
mysql/time_zone_leap_second	33	5
mysql/time_zone_name	33	5
mysql/time_zone_transition	33	6
mysql/time_zone_transition_type	33	8
test/child	33	5
test/parent	33	4
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%parent%");
name	n_fields
PRIMARY	1
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
name	n_fields
GEN_CLUST_INDEX	0
par_ind	1
SELECT name, pos, mtype, len
from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
name	pos	mtype	len
id	0	6	4
parent_id	1	6	4
DROP TABLE child;
DROP TABLE parent;
CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL,
PRIMARY KEY (id, newid)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid)
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID	FOR_NAME	REF_NAME	N_COLS	TYPE
test/constraint_test	test/child	test/parent	2	1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID	FOR_COL_NAME	REF_COL_NAME	POS
test/constraint_test	id	id	0
test/constraint_test	parent_id	newid	1
INSERT INTO parent VALUES(1, 9);
SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
id	newid
1	9
SELECT name, num_rows, ref_count
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
name	num_rows	ref_count
test/parent	1	2
DROP TABLE child;
DROP TABLE parent;
