I have already seen this question and answer, however it doesn't appear to work with temporary tables.
Using MySQL Workbench I've created a temporary table using this code;
create temporary table IF NOT EXISTS tmpMyTable AS (
SELECT * FROM records
)
When I select * from tmpMyTable
I can see the data. However now I need to calculate the size of the tmpMyTable
, in MB.
How can I achieve this? What do I need to edit in the following code?
SELECT
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
WHERE table_schema = "$DB_NAME"
AND table_name = "$TABLE_NAME";
Any advice is appreciated.