Home > database >  Saas platform USES the Shared mysql database tables, each user is how to monitor space occupied by t
Saas platform USES the Shared mysql database tables, each user is how to monitor space occupied by t

Time:09-25

Background: saas platform USES the Shared mysql database, Shared database tables, each table has a foreign key uid to identify each user, and table some fields is varchar type,

Problem: that how to calculate the space occupied by the table size by each user? How to monitor each user changes the size of a table space occupied? Such as table testA, to calculate each user space occupied testA table size, monitor occupies changes the size of a table space, how to achieve this?

Now think of plan: can use Java fields and table field mapping relationship to do ah? Is using Hibernate in the platform, Java objects and database tables are one-to-one, first get Java objects, the length of each field, and then according to this article (http://blog.csdn.net/J080624/article/details/52875344) field size for conversion, record each row corresponds to a tenant, in this way to get to insert the size of one row, then obtain corresponding to the tenant of all sizes, this scheme is feasible, please?

CodePudding user response:

Information_schema. ` TABLES `
Mysql has a similar dynamic view of oracle table, the table above information with table takes up space inside,

CodePudding user response:

reference 1st floor liuzhijian2008x response:
information_schema. ` TABLES `
Mysql has a similar dynamic view of oracle table, the table above there is a table takes up the size of the space information,

Each table is indeed has DATA_LENGTH and INDEX_LENGTH, at an average AVG_ROW_LENGTH the length of the line, but one table has multiple tenants, and table some fields is varchar field, so as to unable to accurately draw each tenant the space occupied by the table size,
  • Related