Article
· Aug 15 3m read

How to identify which temporary globals are consuming size in the IRISTEMP database

InterSystems FAQ rubric

Temporary globals stored in the IRISTEMP/CACHETEMP databases are used when a process does not need to store data indefinitely, but requires the powerful performance of globals. The IRISTEMP/CACHETEMP databases are not journaled, so using temporary globals does not create journal files.

The system uses the IRISTEMP/CACHETEMP databases for temporary storage and are available to users for the same.

For more information about temporary globals and the IRISTEMP database, see the following document:
Temporary Globals and the IRISTEMP Database

The globals used as temporary are:

1. System temporary globals (^IRIS.Temp*, ^%cspSession, ^CacheTemp*, ^mtemp*, etc.)
2. Temporary globals mapped to IRISTEMP/CACHETEMP by the user
3. 
Process private globals  (^||name, ^|"^"|name, ^["^"]name, ^["^",""]name, etc. )
4. GLOBAL TEMPORARY table

 -> The table definition is persistent (available to all processes), and the table data is stored in process private globals (lasts only for the duration of the process)

The sizes of 1 and 2 can be checked using the ^%GSIZE utility.

USER>do ^%GSIZE

Directory name: c:\intersystems\iris\mgr\user\ => c:\intersystems\iris\mgr\iristemp\
                                               // Specify the iristemp database folder
All Globals? No => yes       // Yes to show all globals: 34 items selected
34 available globals
Show details?? No => No   //  No to not show detailed information 
Device:
Right margin: 80 =>

3,4 Process private globals can be viewed using the ^GETPPGINFO utility.

For more information about the ^GETPPGINFO utility, see the following document:
About the ^GETPPGINFO utility [IRIS]
About the ^GETPPGINFO utility

The following example lists the process-private globals of all the current processes:

 set ^||flintstones(1)="Fred"
 set ^||flintstones(2)="Wilma"
 znspace "%SYS"
 do ^GETPPGINFO("*")

Another method is to output the contents of individual processes that use process private globals in large quantities.

The following sample outputs the number of process private global blocks per process that is greater than or equal to 20.

 set ns=$namespace
 znspace "%SYS"
 
 // Only processes with more PPG blocks than the total number of processes are included
 set st=##class(%SQL.Statement).%New()
 set status=st.%PrepareClassQuery("%SYS.ProcessQuery","AllFields")
 set rs=st.%Execute()
 while rs.%Next() {
    set pid=rs.%Get("Pid") // Process ID
    set cnt=rs.%Get("PrivateGlobalBlockCount") // Number of PPG blocks
    
    // When the number of PPG blocks per process is 0 or more, the contents are output (the following example shows 20 or more blocks).
    if cnt > 20 {
       set rs2=##class(%ResultSet).%New("%SYS.ProcessQuery:PPG")
       // "N" Do not return subscripts of a PPG, just return the root name
       // "B" Return the number of blocks used by the PPG (needs the "N" option)
       do rs2.Execute("*",pid,"NB")
       for {
          quit:'rs2.Next()
          write cnt_" PID:"_pid_", PPG name "_rs2.GetData(1)_" is using "_rs2.GetData(3)_" disc blocks",!
       }
    }
 }
 
 znspace ns
Discussion (0)0
Log in or sign up to continue