Question
· Nov 1, 2019

Compaction of Large globals

I would like to Compact globals in a database to free up space.   

I would begin the process on Saturday morning, but am concerned, due to the size, that it would not complete by Sunday evening.  I understand that the process is setup so that it can run with users on the system, however, as the advice indicates, this would not be ideal.

Can the process be stopped if it does not complete by the time you want/need it to?

Do you know how to guestimate how long the process would take?

This is the Freespace for the database in question.  There are 1047 globals of which one of them takes up 50%.

Max Size  Size    Available %Free   Disk Free
Unlimited 1.838TB 279.90GB  14.87   254.37GB

 

Discussion (7)1
Log in or sign up to continue

Are you sure that you really need it?

Yes, you have free space in your database but it will be used when the amount of data stored in this database will grow, so, your free space will become less. I have an article with some visualization, how free-space looks like in a kind of real-life. How Compaction works, it good to read it just to know what expect from those actions. 

In short Compact, just should move all free blocks to the end of the database. It does not return this space to system, you then should do Truncate.

I don't know the way how to measure how much time it will take, it depends on many factors. But you can try run FileCompact method, with quite a small TargetFree, get ActualFree, and with the next time increase TargetFree until you reach desired.

Please make sure the version you are on is safe to run compaction. See Pete Greskoff's 3 links in this developer community post:

https://community.intersystems.com/post/how-reduce-size-intersystems-cach%C3%A9-database-file-cachedat

In InterSystems IRIS as of 2019.1.0, you have the option to monitor and cancel database tasks such as compaction:

Using Character-based Security Management Routines

^DATABASE

option 15. Show background database tasks
"Displays a list of background tasks that are running or that have run since startup. You can also use this option to re-enter the monitor screen, where you can cancel a currently running task as well as purge the history of completed tasks. (Note that the tasks listed here are not the same as those listed as scheduled tasks in the Task Manager.)"

We don't have that option in Cache yet.  (Getting ready to upgrade to 2017 - but checked, and it doesn't either).

%SYS>D ^DATABASE

 1) Create a database
 2) Edit a database
 3) List databases
 4) Delete a database
 5) Mount a database
 6) Dismount a database
 7) Compact globals in a database
 8) Show free space for a database
 9) Show details for a database
10) Recreate a database
11) Manage database encryption
12) Return unused space for a database
13) Compact free space in a database
14) Defragment globals in a database

Option? Q

%SYS>D ^VERSION
Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2015.2.3 (Build 855_0_17370) 

I wonder if Canceling from that option in IRIS is the same as Terminating a Process in cache - risking data integrity issues with ab-ends...