Determine size in kb of a BLOB column in DB2

2019-06-25 12:27发布

问题:

File table contains - File_Id and File_data(BLOB)

how can I know the size of the binary file stored in File_data column. length function gives the length of file but how to know the size in KB.

回答1:

This gives a number in bytes, devide it by 1024 to get size in KB.

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


回答2:

BLOB Length is not quite the same as size.

You first need to answer NO to all of these questions for it to be the file size:

  1. Is the BLOB column declared as COMPACT?
  2. Is the table data compressed? (Off by default)

Also consider LOB locator overhead.

Basically the answer is, that you can't really 100% determine the BLOB / actual file size from the column via length method.



标签: size db2 blob