10

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.

Community
  • 1
  • 1
Cherry
  • 31,309
  • 66
  • 224
  • 364

2 Answers2

7

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

SELECT sum(char_length(comment)) FROM tbl_comments
Raghbendra Nayak
  • 1,606
  • 3
  • 22
  • 47
2

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

Tibee
  • 31
  • 2
  • 1
    Welcome to Stack Overflow! Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Toby Speight Jan 12 '17 at 10:41
  • 1
    Cherry didn't describe specifically what type of column want to use. I can copy-paste the entire reference manual, but it looks easier to link it. Thanks your advice. – Tibee Jan 12 '17 at 11:36