How Much Space Is Being Used by 1 LOB / CLOB / BLOB in DB2

Building off of yesterdays lesson on how to determine how much space a table is using (including LOBs and Indexes), there may come a time when you need to determine how much space 1 or more specific records are taking up. To do that, use the LENGTH() function which will return you how many bytes the field is using. Simply do some math to get a more useful value (like KB).

SELECT length(LOB_DATA_X) BYTE_A, length(LOB_DATA_X) / 1024 KB_A
FROM XX.MY_TABLE
FETCH FIRST 10 ROWS ONLY WITH UR FOR READ ONLY;

Leave a Reply