tags:

views:

30

answers:

2

anyone know how to determine the size of an index in mysql(5.1)????

thanks in advance

+3  A: 

is this what you need? (from here)

William
that is exactly what i am looking for. thanks.
rafael
one more thing, the 'Index_length' field is in bytes i take it????
rafael
+2  A: 

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, ...

http://www.linkedin.com/in/rolandoedwards

RolandoEdwards
@user491757 - welcome to SO. "Signatures" in answers are generally discouraged - people will go look at your profile page if they're interested: http://stackoverflow.com/users/491757/user491757 More details in the FAQ: http://stackoverflow.com/faq
McDowell