Determine the kb size of a BLOB column in DB2

The file table contains - File_Id and File_data (BLOB)

how to find out the size of the binary file stored in the File_data column. length

the function gives the length of the file, but how do I know the size in KB.


source to share

2 answers

This gives the number in bytes, divides it by 1024 to get the size in KB.

Select sum(BIGINT(length(blob_column)))
from table;




BLOB length is not exactly the same as size.

You first need to answer NO to all of these questions so that this is the file size:

  • Is the BLOB column declared COMPACT?
  • Is the table data compressed? (Disabled by default)

Also consider the LOB locator overhead.

Basically the answer is that you cannot 100% determine the size of the BLOB / actual file from a column by the length method.



All Articles