| 1 |
# |
| 2 |
# A basic test for |
| 3 |
# INFORMATION_SCHEMA.INNODB_CACHED_INDEXES |
| 4 |
# |
| 5 |
|
| 6 |
|
| 7 |
CREATE TABLE test_cached_indexes ( |
| 8 |
a INT, |
| 9 |
b INT, |
| 10 |
c INT, |
| 11 |
PRIMARY KEY (a), |
| 12 |
KEY `index_on_b` (b), |
| 13 |
KEY `index_on_bc` (b, c) |
| 14 |
) ENGINE=INNODB; |
| 15 |
|
| 16 |
SELECT |
| 17 |
tables.name AS table_name, |
| 18 |
indexes.name AS index_name, |
| 19 |
cached.n_cached_pages AS n_cached_pages |
| 20 |
FROM |
| 21 |
information_schema.innodb_cached_indexes AS cached, |
| 22 |
information_schema.innodb_indexes AS indexes, |
| 23 |
information_schema.innodb_tables AS tables |
| 24 |
WHERE |
| 25 |
cached.index_id = indexes.index_id |
| 26 |
AND cached.space_id = indexes.space |
| 27 |
AND indexes.table_id = tables.table_id |
| 28 |
AND tables.name LIKE '%test_cached_indexes' -- remove this line to see all cached indexes |
| 29 |
ORDER BY 1, 2, 3; |
| 30 |
|
| 31 |
DROP TABLE test_cached_indexes; |