Getting MySQL table size with PHP

Below is a small script that lets you read the table sizes of a MySQL database.



It will return data like the following for a ‘wordpress’ database:

Array
(
    [wp_comments] => 80.00
    [wp_links] => 48.00
    [wp_options] => 224.00
    [wp_pollsa] => 16.00
    [wp_pollsip] => 16.00
    [wp_pollsq] => 16.00
    [wp_postmeta] => 48.00
    [wp_posts] => 112.00
    [wp_term_relationships] => 32.00
    [wp_term_taxonomy] => 32.00
    [wp_terms] => 48.00
    [wp_usermeta] => 48.00
    [wp_users] => 48.00
)

3 thoughts to “Getting MySQL table size with PHP”

  1. so far this the best i found on internet. useful even i’m not fully understand how it work. but this is want i want. thanks

Comments are closed.