问题
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:
- Is the BLOB column declared as COMPACT?
- 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.
来源:https://stackoverflow.com/questions/9922479/determine-size-in-kb-of-a-blob-column-in-db2