TIBCO LogLogic LMI - Show table sizes in MySQL

TIBCO LogLogic LMI - Show table sizes in MySQL

book

Article ID: KB0077068

calendar_today

Updated On:

Products Versions
TIBCO LogLogic Enterprise Virtual Appliance all versions

Description

When troubleshooting it can be useful to know the size of the tables in a particular database. The following script will give that information:

Issue/Introduction

This article contains a script to show database table sizes in MB for a particular database.

Resolution

SELECT table_name AS "Table",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "logappconfig"


The database table name is shown in bold above. If you wish to see the output for another database then simply change the name there. In addition, you may wish to see the size of the tables given in GB rather than MB - this is especially handy when working with large reporting tables on an LX or MX model appliance. To do this, simply change this line in the script:

round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"

to this:

round(((data_length + index_length) / 1024 / 1024 / 1024), 2) "Size in GB"