- 最新
- 投票最多
- 评论最多
Hi there.
I'm a little confused because you mentioned a table with 800K rows but your query is getting the size of your entire database. If you want to know the size of a particular table, use the column TABLE_NAME. Try the query with this little modification:
SELECT
table_name "Table",
SUM(data_length + index_length) / 1024 / 1024 "Total Size (MB)"
WHERE table_schema = [NAME OF YOUR DATABASE]
FROM information_schema.tables
GROUP BY table_name;
I hope this helps.
Hi,
In order for information_schema to not be painfully slow when retrieving this for large tables, it uses estimates, based on the cardinality of the primary key, for InnoDB tables. Otherwise it would end up having to do SELECT COUNT(*) FROM table_name, which for a table with billions of rows could take hours.
Look at SHOW INDEX FROM table_name and you will see that the number reported in information_schema is the same as the cardinality of the PK.
Running ANALYZE TABLE table_name will update the statistics which may make them more accurate, but it will still be an estimate rather than just-in-time checked row-count.
Best,
Didier
It says The storage engine for the table doesn't support analyze
The engine says CSV. It's a systema created table, not by me
相关内容
- AWS 官方已更新 3 年前
Thanks for your reply, but is the same. The entire mysql data base size is the same as before the 800k records
In fact, the general_log size according to information.schema es 0.00000000
Now is 965k records
As stated in the question, is like if information_schema never updates the information
The RDS instance is a 100 GiB of storage, I only want to see how much of that storage I've used.