Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
350 views
in Technique[技术] by (71.8m points)

diskspace - How to calculate the disk space(memory in filesystem) taken for storing a mysql table row?

I have created a table in mysql database like below

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `email` varchar(200) NOT NULL,
  `address` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`);
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

And, inserted 2 rows of data in above table

INSERT INTO `users` (`id`, `email`, `address`) VALUES (NULL, 'first@a.a', 'short address');
INSERT INTO `users` (`id`, `email`, `address`) VALUES (NULL, 'second@a.a', 'this is a long address');

And, if I check the data in the table, it will show like this

id    email        address
-------------------------------------
1     first@a.a    short address
2     second@a.a   this is a long address

Now, I want to know how much disk space occupied by this table (row wise).

So, I need something like below (X,Y are just for illustration purpose, there I need actual values)

id    email        address                       row size
----------------------------------------------------------
1     first@a.a    short address                 X bytes
2     second@a.a   this is a long address        Y bytes
question from:https://stackoverflow.com/questions/65880449/how-to-calculate-the-disk-spacememory-in-filesystem-taken-for-storing-a-mysql

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...