Pages

Sunday 23 February 2014

Use the below command to dispalay the size of every table from a particular database psa.

SELECT table_name AS 'Tables',
round(((data_length + index_length) / 1024 / 1024), 2) 'Size in MB'
FROM information_schema.TABLES
WHERE table_schema = 'psa';



Ex:-


mysql> SELECT table_name AS 'Tables',
    -> round(((data_length + index_length) / 1024 / 1024), 2) 'Size in MB'
    -> FROM information_schema.TABLES
    -> WHERE table_schema = 'psa';
+-------------------------------+------------+
| Tables                        | Size in MB |
+-------------------------------+------------+
| APSApplicationItems           |       0.05 |
| APSCatalogUpdates             |       0.02 |
| APSClientApplicationItems     |       0.06 |
| APSLicenseTypes               |       0.05 |
| APSLicenses                   |       0.03 |
| ApiRpcCallsStat               |       0.03 |
| BackendCache                  |       0.02 |
| BackupsScheduled              |       0.02 |
| BackupsSettings               |       0.03 |
| Cards                         |       0.02 |
| ClientsTraffic                |       0.02 |
| Components                    |       0.02 |
| Configurations                |       0.03 |
| DashboardPreset               |       0.03 |
| DashboardPresetConfig         |       0.06 |
| DatabaseServers               |       0.03 |
| DomainServices                |       0.05 |

Likewise for a single domain size we can use below query:-

SELECT table_name AS 'DOMAINS',
round(((data_length + index_length) / 1024 / 1024), 2) 'Size in MB'
FROM information_schema.TABLES
WHERE table_schema = 'psa'
AND table_name = 'domains';

No comments:

Post a Comment