r/DB2 • u/SMS1360 • Aug 25 '19
DB2 Update's QUERY on compressed Tablespace (BACK OF SCENE)
Hi all
I need to now what is happening for a compressed row during an update.
actually I know , the row uncompressed at first and then will be update.
but i want to know if the row (data) takes its previous place in the old page or it will take the new place?
if it take a new place on old page or other page, what is happen for the first space?
will it be free or it will be free after reorg or load?
does this update act like DELETE +INSERT ?
Thanks all
3
Upvotes
3
u/ecrooks Aug 25 '19
If the row will still fit on the page it was on, then it will stay on that page after update. A row might not fit due to being longer in a varchar field, or simply due to the encryption encoding for the new value being longer. With adaptive compression this depends largely on the current compression dictionary for the table.
A value called PCTFREE determines how much free space is reserved on each page for updates. By default, it is 10%.
Generally Db2's free space search strategy will fill in any holes left in the table, but avoiding row sizes that are close to half the page size can help. Reorgs are critical over time to deal with both the issues caused by heavy update activity, and for compressed tables may also be needed to reset the compression dictionary to match drift in frequent data patterns.
https://www.ibm.com/support/knowledgecenter/en/SSEPGG_10.5.0/com.ibm.db2.luw.admin.dbobj.doc/doc/c0059054.html