Original Message:
Sent: Thu August 22, 2024 07:59 AM
From: Dennis Melnikov
Subject: Defragment sbspace
Vicente,
What is 'object_id'? Does it have a corresponding key in some system table?
------------------------------
Sincerely,
Dennis
Original Message:
Sent: Thu August 22, 2024 07:25 AM
From: Vicente Salvador Cubedo
Subject: Defragment sbspace
Indeed, my test server is little indian. Unfortunately, smartblob to lvarchar casting don't show all the required metadata info.
This is all I know about data showed in cast conversión:
select ("0x" || SUBSTR(c1::LVARCHAR,23,2) || SUBSTR(c1::LVARCHAR,21,2) || SUBSTR(c1::LVARCHAR,19,2) || SUBSTR(c1::LVARCHAR,17,2))::INT dbsnum,
("0x" || SUBSTR(c1::LVARCHAR,31,2) || SUBSTR(c1::LVARCHAR,29,2) || SUBSTR(c1::LVARCHAR,27,2) || SUBSTR(c1::LVARCHAR,25,2))::INT chknum,
("0x" || SUBSTR(c1::LVARCHAR,39,2) || SUBSTR(c1::LVARCHAR,37,2) || SUBSTR(c1::LVARCHAR,35,2) || SUBSTR(c1::LVARCHAR,33,2))::INT chkpage,
("0x" || SUBSTR(c1::LVARCHAR,47,2) || SUBSTR(c1::LVARCHAR,45,2) || SUBSTR(c1::LVARCHAR,43,2) || SUBSTR(c1::LVARCHAR,41,2))::INT object_id
from test;
Just convert this command from LE to your BE platform
Vicente
------------------------------
Vicente Salvador Cubedo
Original Message:
Sent: Wed August 21, 2024 11:05 AM
From: Dennis Melnikov
Subject: Defragment sbspace
Vicente,
According to the note your method is for little-endian platforms like Linux (some) and Windows.
The 1st method works fine on AIX.
BTW, do you know how to extract offset (and size) from the LVARCHAR? Server Studio displays length of blob in SELECT, but I have no idea how it gets it.
------------------------------
Sincerely,
Dennis
Original Message:
Sent: Wed August 21, 2024 10:16 AM
From: Vicente Salvador Cubedo
Subject: Defragment sbspace
It's not exactly like this:
Check this method:
select ("0x" || SUBSTR(c1::LVARCHAR,23,2) || SUBSTR(c1::LVARCHAR,21,2) || SUBSTR(c1::LVARCHAR,19,2) || SUBSTR(c1::LVARCHAR,17,2))::INT dbsnum,
("0x" || SUBSTR(c1::LVARCHAR,31,2) || SUBSTR(c1::LVARCHAR,29,2) || SUBSTR(c1::LVARCHAR,27,2) || SUBSTR(c1::LVARCHAR,25,2))::INT chknum
from test
------------------------------
Vicente Salvador Cubedo
Original Message:
Sent: Wed August 21, 2024 09:08 AM
From: Dennis Melnikov
Subject: Defragment sbspace
Ok, at least, sbspace num and chunk num are easy to extract:
sbsnum = ("0x" || SUBSTR(<sblob_col>::LVARCHAR,17,8))::INT
chunknum = ("0x" || SUBSTR(<sblob_col>::LVARCHAR,25,8))::INT
That gives a good starting point for repacking a sbspace.
------------------------------
Sincerely,
Dennis
Original Message:
Sent: Wed August 21, 2024 05:20 AM
From: Dennis Melnikov
Subject: Defragment sbspace
Vicente,
The note explains how to determine a sbspace that holds the sblob: https://www.ibm.com/support/pages/how-determine-which-sbspace-tables-sblobs-reside
Is it possible to extract an offset too?
------------------------------
Sincerely,
Dennis
Original Message:
Sent: Wed August 21, 2024 04:30 AM
From: Vicente Salvador Cubedo
Subject: Defragment sbspace
SmartBlob spaces cannot be "defragmented" as they contains chunks of data and there is at the row itself that stores the offset and length of this chunk of data.
Only think you can do is to "rewrite" the blobs and pray for enough free space to really reposition the data in "free space". But there are nothing that can assure you, that data will be countinously writen.
E.g.
UPDATE mytable SET locolumn = LOCOPY(locolumn, 'mytable', 'locolumn')
You need to test this. Other method is to create a new smartblob, change the put clause for the column to this new smartblob and copy all data:
UPDATE mytable SET locolumn = LOCOPY(locolumn, 'mytable', 'locolumn')
This will move smartblobs to new smartblobspace defined in the put clause for the column.
Please, test all this before executing in production.
------------------------------
Vicente Salvador Cubedo
Original Message:
Sent: Tue August 20, 2024 07:50 AM
From: Dennis Melnikov
Subject: Defragment sbspace
Hi,
IBM Informix Dynamic Server Version 11.70.FC5XE
Please, how to defragment (repack) a sbspace after plenty LOBs been deleted?
------------------------------
Sincerely,
Dennis
------------------------------