Querying the amount of data in all tables of the MySQL database.
You can use the following SQL statement to query the data size of all tables in a MySQL database:
SELECT
TABLE_SCHEMA AS 'Database',
TABLE_NAME AS 'Table',
TABLE_ROWS AS 'Row Count'
FROM
INFORMATION_SCHEMA.TABLES
WHERE
TABLE_TYPE = 'BASE TABLE'
AND TABLE_SCHEMA NOT IN ('information_schema', 'mysql', 'performance_schema', 'sys')
ORDER BY
TABLE_SCHEMA,
TABLE_NAME;
This query will return the database names, table names, and row counts for each table. Please note that the above query will not include views and temporary tables. You can use the WHERE clause to filter out specific databases as needed (such as information_schema, mysql, performance_schema, and sys).
This query utilizes the built-in information schema of MySQL, which provides metadata information about databases, tables, and columns.