Home > Forum > Database > Save space on SQL server with ATF_IsDeleted?

Save space on SQL server with ATF_IsDeleted?
0

Dear Community,
I have a question regarding attachments database. Size of the database is quite large and I'm trying to find optimizations here.
Table / index compression is not a solution - compression ratio is barely reaches 0,5% level.
I have found a lot of records in this database where attachments are deleted (column ATF_IsDeleted = 1). Is it safe to remove such records from database or it will make inconsistency of the data? Do you have any experience in it?

Looking forward for any comments.

MVP

I think that in your processes if you don't need the attachments anymore, on the removal action you can check the "remove binary data" option. This would remove the content of the file competely.

Also for any other instances you can use the archiving functionality. This can either move your records in another archive database or completely remove them I think. Also I am not sure what the behaviour for the attachments would be in the case of archivation, but it is worth a try.

Dear Razvan,
thanks for quick response. Your suggestion is fine when you have action to remove attachments. Unfortunately, users are removing attachments directly in Attachments area, not by action on path. Also, this operation can't affect already deleted attachments (binary data). I want to remove raw binary data from SQL table. These attachments are not visible and available from WEBCON BPS Portal.

Archiving is just moving data from one DB to another, and you still need place for that :) With archive functionality I think I'm not able to select only deleted attachments. Archiving will affect all attachments based on archive criteria.

Nevertheless, thanks for your feedback here.

Dear All,
I have prepared action with deleting attachments as suggested. While making test BPS Studio window, it shows 4 records (attached here). For testing purposes SQL command criteria is limited to exact WFD_ID (the one we do test on). When running this action in BPS portal it is proceed (no error) but I have information (in history) that no attachments were found.
When removed criteria "IsDeleted = 1" it removed all attachments from specified document. All of them are now in Attachments database marked as "IsDeleted = 1". Also, the old ones "deleted" previously. But they are still in DB but field ATT_Value is NULL. So it's a progress.

In remove attachment properties action, I have selected option to remove binary data and history.

Dear Martin, Razvan,
from my tests I have discovered and acknowledged that:
- if file is not marked as deleted and you perform such action (delete attachment action form BPS) binary data is deleted (ATF_Value = 0x in WFAttachmentsFiles table in attachment DB; action parameter to delete binary data and history);
- if file in marked as deleted binary data is not deleted (no actions are performed on those rows even if I specify in query to remove ATT_IsDeleted = '1');

So, in my case (if I want to free up space in DB) this scenario is not sufficient.

I could try to set "0x" values in ATF_Value column for all rows where ATF_IsDeleted = '1' but this is something that ingrates far too much in DB consistency :)