Determine size in kb of a BLOB column in DB2

♀尐吖头ヾ 提交于 2020-01-03 16:47:32

问题


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.



来源:https://stackoverflow.com/questions/9922479/determine-size-in-kb-of-a-blob-column-in-db2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!