Skip to content

Instantly share code, notes, and snippets.

@januszm
Created September 25, 2023 21:24
Show Gist options
  • Select an option

  • Save januszm/3f5d644a12c34ff6d6a7f88908ce8d98 to your computer and use it in GitHub Desktop.

Select an option

Save januszm/3f5d644a12c34ff6d6a7f88908ce8d98 to your computer and use it in GitHub Desktop.

Revisions

  1. januszm created this gist Sep 25, 2023.
    10 changes: 10 additions & 0 deletions mysql_table_size.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    SELECT
    TABLE_NAME AS `Table`,
    ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
    FROM
    information_schema.TABLES
    WHERE
    TABLE_SCHEMA = "mydatabase"
    ORDER BY
    (DATA_LENGTH + INDEX_LENGTH)
    DESC;