Skip to content

Instantly share code, notes, and snippets.

@zabaala
Created September 22, 2016 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zabaala/8b32987b23d73e89ce451f81a55a4a39 to your computer and use it in GitHub Desktop.
Save zabaala/8b32987b23d73e89ce451f81a55a4a39 to your computer and use it in GitHub Desktop.
DROP IF EXISTS TABLE [tmp_table_name];
CREATE TABLE [tmp_table_name] engine=innodb (select * from [reference_table] where ...);
SELECT
TABLE_NAME AS `Table`,
ROUND(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '[schema]' AND TABLE_NAME = '[tmp_table_name]';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment