Written by

Question Rochdi Badis · May 2, 2024

Compact & Truncate

Hi Guys,

I never ran a Compact & truncate process before and we do have a 4.6TB database with 1.9TB free space available that I would like to recover 

but when trying to compact first it did ask me to target in MBs and not sure what this is, does it mean that I need enough space to move all my 4.6TB database to ? and given that system is running live does the Compact or Truncate process stop or affect our system from been used from our clients and any idea how long such process would take to finish (minutes or hours) ?  

Thanks

Product version: Caché 2018.1

Comments

Luis Angel Pérez Ramos · May 2, 2024

From the official documentation: 

The compact database operation is designed to run concurrently with normal database activity. The operation does consume some system resources, however, and may not complete if the system is under extremely high load. For these reasons, InterSystems recommends running this and other database reorganization operations (including compacting and defragmenting globals) during off-peak hours, and running only one such operation on a system at a time.

https://docs.intersystems.com/iris20241/csp/docbook/DocBook.UI.Page.cls…

0
Alexander Pettitt · May 2, 2024

Truncate can only remove free space from the end of the file.
Compact is asking how much free space do you want at the end of the file.
The free space is likely not evenly distributed.
I mostly used the ^DATABASE utility.

0
Rochdi Badis  May 2, 2024 to Alexander Pettitt

So in my case I can specify at least 1.8TB (in MBs of course) as a free space that I need to recover? 

0
Rochdi Badis  May 2, 2024 to Alexander Pettitt

and any idea of how long such process take, give or take?

0
Alexander Pettitt · May 2, 2024

1.9Tb will be days assuming ssd storage and slower if not.
I would test a small amount during a low period.

0
Roger Merchberger · May 2, 2024

I noticed that you're using Cache 2018.1. I'd like to just warn you that as of Cache 2017, this functionality was quite broken and InterSystems recommends you not use it. I don't know if it was fixed in 2018 or a later version, so I don't know for sure if your version is affected, but it's something you may want to be aware of.

If the functionality wasn't fixed in 2018, you can still recover the space in the database but it will have to be offline as no modifications to the database can happen during the process. There's a utility named ^GBLOCKCOPY that can copy all of the global database blocks from your existing database to a new one where the new database will only grow as large as necessary thereby reclaiming the free space.

See my answer to this post: https://community.intersystems.com/post/ensemble-2013-compacttruncate

And, here's more documentation regarding the ^GBLOCKCOPY utility: https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=GSTU_remote_gblockcopy

Hope this helps!

0