Monday, 12 December 2016

How to get the sizes of the tables in mysql database?

How to get the sizes of the tables in mysql database?


Question: How to get the sizes of the tables in mysql database?
SELECT table_name "Table Name",SUM( data_length + index_length ) / 1024 / 1024 "Table Size (MB)",SUM( data_free )/ 1024 / 1024 "Free Space(MB)" FROM information_schema.TABLES WHERE table_schema='mydb' GROUP BY table_name ORDER BY SUM(TABLE_ROWS) DESC

Output
How to get the sizes of the tables in mysql database



Question: Get record counts for all tables along with size in MySQL database?
SELECT table_name "Table Name",SUM( data_length + index_length ) / 1024 / 1024 "Table Size (MB)",SUM( data_free )/ 1024 / 1024 "Free Space(MB)", SUM(TABLE_ROWS) AS "Total Record(S)" FROM information_schema.TABLES WHERE table_schema='mydb' GROUP BY table_name ORDER BY SUM(TABLE_ROWS) DESC

Output

Get record counts for all tables in MySQL database


1 comment :

Kevin Lee said...

Hello Buddy,


Gratitude for putting up this prolific article! You truly make everything a cake walk. Genuinely good stuff, saving time and energy.

Is it possible to implement a server side feature that will export PivotGrid view to Excel/PDF/Word files based on the same datasource that angular control (ej-pivotgrid) is?
I mean this structure:
$scope.datasource = {
data: [],
values: [],
rows: [],
columns: []
};

If yes can you direct me in the right way?

But great job man, do keep posted with the new updates.


Merci Beaucoup,

Post a Comment