Get the App
SLTechnology News&Howtos  ›  Database  › 

Want to know how the mysql database and table footprint should be viewed

Shulou Source: shulou.com Published: 2022-06-01 19:57:29 10月05日 Update

The following mainly brings you how to view the mysql database and table occupancy space. I hope that how to view the mysql database and table footprint can bring you practical use, which is also the main purpose of my editing this article. All right, don't talk too much nonsense, let's just read the following.

1. The space occupied by the database

SELECT CONCAT (TRUNCATE (SUM (data_length) / 1024 SUM 1024), 'MB') AS data_size

CONCAT (TRUNCATE (SUM (max_data_length) / 1024 SUM 1024), 'MB') AS max_data_size

CONCAT (TRUNCATE (SUM (data_free) / 1024 SUM 1024), 'MB') AS data_free

CONCAT (TRUNCATE (SUM (index_length) / 1024 SUM 1024), 'MB') AS index_size

FROM information_schema.tables WHERE TABLE_SCHEMA = 'database name'

2. Space occupied by tables

SELECT CONCAT (TRUNCATE (SUM (data_length) / 1024 SUM 1024), 'MB') AS data_size

CONCAT (TRUNCATE (SUM (max_data_length) / 1024 SUM 1024), 'MB') AS max_data_size

CONCAT (TRUNCATE (SUM (data_free) / 1024 SUM 1024), 'MB') AS data_free

CONCAT (TRUNCATE (SUM (index_length) / 1024 SUM 1024), 'MB') AS index_size

FROM information_schema.tables WHERE TABLE_NAME = 'table name'

For the above about how the mysql database and table footprint should be viewed, you do not find it very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

Tags: Data database space following text content reality nonsense more usefulness purpose article industry information help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi NVidia Microsoft macOS Redmi