Size of a table in mysql

Viewed 228

I have a table :

create table a(a1 int, a2 char(10),a3 float);

I can manually count the number of bytes allocated for this table a. But, how to find its size in mysql with some queries???

1 Answers

IF you are looking for physical table size of table a

SELECT
  TABLE_NAME AS `Table`,
  ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
  information_schema.TABLES
WHERE
    TABLE_SCHEMA = '<schema>'
  AND
    TABLE_NAME = 'a'
ORDER BY
  (DATA_LENGTH + INDEX_LENGTH)
DESC;
Related