Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
342 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, '[email protected]', 'short address');
INSERT INTO `users` (`id`, `email`, `address`) VALUES (NULL, '[email protected]', 'this is a long address');

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

id    email        address
-------------------------------------
1     [email protected]    short address
2     [email protected]   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     [email protected]    short address                 X bytes
2     [email protected]   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 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...