Cherry
Cherry

Reputation: 33534

Is there a way to calculate total data size of column in MySql?

Here is a solution how calculate table size, but what about column? Is there apporoach to calculate data which stored only for 1 column of table?

Note

The question is about data size, not data type size.

Upvotes: 10

Views: 4478

Answers (2)

Raghbendra Nayak
Raghbendra Nayak

Reputation: 1646

You can use below query that will return data size in bytes:

SELECT sum(char_length(comment)) FROM tbl_comments

Upvotes: 7

Tibee
Tibee

Reputation: 31

You can check in the storage requirements in the reference manual, and you can calculate your column size.

If you don't want to read too much, you can find some page, where is a collection about sizes and an online calculator: calculator

Upvotes: 2

Related Questions