Determining Sizes of Globals
InterSystems IRIS® data platform provides tools you can use to measure the size of any global.
^%GSIZE Routine
The ^%GSIZE routine enables you to determine the size of one or more globals. To use this routine:
-
Start an ObjectScript shell.
-
Start the routine:
do ^%GSIZE
-
The first prompt lets you specify the database to look at. The prompt refers to the directory that contains the database file:
Directory name: c:\intersystems\iris211\mgr\enslib\ =>
The default is the globals database used by the namespace that you are currently in. You can either press Enter to accept this default, or type a full directory name and then press Enter.
-
The next prompt is as follows:
All Globals? No =>
If you want information on all globals, enter Y (case-insensitive). Otherwise press Enter.
Note:If you request information on all globals, that includes all the internal, undocumented globals as well as your own globals. Some of these are quite large.
-
If you did not enter Y in the previous step, the next prompt looks like the following, which is asking for a global name:
Global ^
Type the global name, without the leading caret and press Enter.
Repeat as necessary. When you are done entering global names, press Enter again. Then the routine displays a message indicating how many globals you have selected:
All Globals? No => No Global ^IRIS.Msg Global ^ 1 global selected from 64 available globals.
-
The next prompt asks about the kind of report to generate:
1) Get exact packing details 2) Get block counts only 3) Use fast stochastic estimate Please select an option: 3 =>
Option 1 scans the entire global and obtains full information; this is time-consuming for a large global. Option 2 obtains only the block counts. Option 3 (a new feature in release 2023.3) estimates the size, which is faster than scanning the entire global.
Enter 1, 2 or 3.
-
Press Enter for the next two prompts, which let you specify where to write the output:
Device:
and
Right margine: 80 =>
-
The routine then displays output like the following, when using option 1 or 3:
Page: 1 Global Blocks Bytes Used Packing ----------- ---------------- ------------------- ------- IRIS.Msg 942 5,791,760 75 % TOTAL Blocks Bytes Used Packing ----------- ---------------- ------------------- ------- 942 5,791,760 75 %
When using option 2, the report displays only the block counts.
APIs for Getting Global Sizes
Several classes provide APIs for getting sizes of globals:
-
The class %GlobalEditOpens in a new tab provides methods such as the following:
-
CheckIntegrity()
-
GetGlobalSize()
-
GetGlobalSizeBySubscript()
-
And others
-
-
The class %SYS.GlobalQueryOpens in a new tab provides the following queries:
-
DirectoryList()
-
NameSpaceList()
-
NameSpaceListChui()
-
Size()
-