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