0

I'm using following query to get index and data sizes for tables in database. But unfortunately it doesn't show index size for compound unique indexes. How can i get index sizes for compound unique indexes?

Here is my query;

SELECT TABLE_NAME AS "Table",
TABLE_ROWS AS "Rows",
CONCAT((FORMAT((DATA_LENGTH) / POWER(1024,2),2)), ' Mb') AS "Data Size",
CONCAT((FORMAT((INDEX_LENGTH) / POWER(1024,2),2)), ' Mb') AS "Index Size",
CONCAT((FORMAT((DATA_LENGTH+ INDEX_LENGTH) / POWER(1024,2),2)), ' Mb') AS "Total Size",
TRIM(TRAILING ', ' FROM CONCAT_WS(', ', ENGINE, TABLE_COLLATION, CREATE_OPTIONS)) AS "Type"
FROM information_schema.TABLES
WHERE information_schema.TABLES.table_schema = "my_database_name_here"
asked Oct 10, 2015 at 16:52
2
  • Index Size contains total sum of sizes of all (non-primary) indexes defined on the table, there is no simple way to get the size of one specific index afaik Commented Oct 10, 2015 at 17:52
  • "non-primary" for InnoDB at least, in MyISAM even the primary key will be counted in the index size. Commented Oct 11, 2015 at 8:44

1 Answer 1

0

For MySQL (not Percona), see if this table gives you what you want:

mysql.INNODB_INDEX_STATS

Sorry, but it is not easy to tease out the specific data you asked about.

answered Oct 21, 2015 at 21:57

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.