如果你想知道空间在MySQL数据库的每个表占用和记录表中的行数,你可以打开MySQL information_schema数据库。在图书馆里,有一个表格,这是主要的领域:

table_schema:数据库名称

table_name:表名

引擎:使用的存储引擎

tables_rows:记录数

data_length:数据大小

index_length:索引的大小

对于其他领域,请参考MySQL的手册,这对我们最有用。

占空间的表的大小,相当于数据的大小和索引的大小,

实例:

1。想看到所有的HX库表的大小,你可以使用:

复制代码代码如下所示:

选择table_name,data_length + index_length,从information_schema.tables哪里table_schema = 'hxtable_rows;

+ + + + ------------------- -------------------------- ------------

table_name data_length + index_length table_rows | | | |

+ + + + ------------------- -------------------------- ------------

| enjoy_data | 6979584 | 70113 |

| hx_record | 113410048 | 753279 |

| itlearner_record | 21835546624 | 104917777 |

| tmp_day_id | 17326 | 811 |

+ + + + ------------------- -------------------------- ------------



2。想看喜欢的HX库表的大小,可以使用:

复制代码代码如下所示:

选择data_length + index_length,从information_schema.tables哪里table_schema = 'hx'and table_name = 'enjoy_datatable_rows;



回归uff1a

复制代码代码如下所示:

-------------------------- ------------ + + +

| data_length + index_length | table_rows |

-------------------------- ------------ + + +

| 6979584 | 70113 |

-------------------------- ------------ + + +