如何计算mysql一条记录的存储大小?
PHP中文网
PHP中文网 2017-04-17 15:48:28
0
1
630

如何根据表结构来计算一条记录占用的存储大小?

https://link.zhihu.com/?targe...

是否可以根据上述规则来计算?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
迷茫

Thanks for the invitation. I think that indexing the table cannot be based entirely on the storage size occupied by the table structure, as it will also increase the storage size.
If you want to know the space occupied by each table in the Mysql database and the number of rows recorded in the table, you can open the information_schema database of mysql. There is a Tables table in this library. The main fields of this table are:
TABLE_SCHEMA: database name
TABLE_NAME: table name
ENGINE: storage engine used
TABLES_ROWS: number of records
DATA_LENGTH: data size
INDEX_LENGTH: index size
So to know the size of the space occupied by a table, it is equivalent to data size + index size.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!