rrevi
rrevi

Reputation: 1051

How do I determine the size of an index in MySQL 5.1?

How do I determine the size of an index in MySQL 5.1?

Upvotes: 3

Views: 2994

Answers (2)

RolandoMySQLDBA
RolandoMySQLDBA

Reputation: 44343

Use INFORMATION_SCHEMA.TABLES

Example : For a table called mydb.mytable, run this query

SELECT index_length NDXSIZE FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema='mydb' AND table_name='mytable';

Answer comes back in bytes. If you want the answer in KB do this:

SELECT index_length/POWER(1024,1) NDXSIZE FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema='mydb' AND table_name='mytable';

For MB, use POWER(1024,2)

For GB, use POWER(1024,3)

etc, etc, ...

Upvotes: 4

William
William

Reputation: 3529

is this what you need? (from here)

Upvotes: 5

Related Questions