Calculating total data size of BLOB column in a table

jatinpreet picture jatinpreet · May 18, 2012 · Viewed 50k times · Source

I have a table with large amounts of BLOB data in a column. I am writing a utility to dump the data to file system. But before dumping, I need to check if necessary space is available on the disk to export all the blob fields throughout the table.

Please suggest an efficient approach to get size of all the blob fields in the table.

Answer

Bud Damyanov picture Bud Damyanov · May 18, 2012

You can use the MySQL function OCTET_LENGTH(your_column_name). See here for more details.