Reputation: 46387
In a MySQL database how can you tell the storage size that each column of a table is taking up? Relevant for variable length columns like TextField.
Upvotes: 0
Views: 158
Reputation: 1364
To character data field, would be:
SELECT SUM(LENGTH(`column`)) FROM `Table`
If you are using some numerical data type, you could just get a count on the rows, and multiply it by the size, for instance 4 for INTEGER, or 8 for DOUBLE, but It won't reflect the actual size taken up on disk however.
You can get the size of an entire table with:
SHOW TABLE STATUS LIKE `Table`;
Upvotes: 2