Question
· Aug 24, 2016

cacheStream Table

I ran %GSIZE and my ^cacheStream global is very large. How do I go about 

1. Evaluating what data is in the global.

2. Clean it up.

Thanks!

Discussion (1)0
Log in or sign up to continue
Hi Paul,
 
Hope this helps:
 
ClassMethod GLOBALSIZEPERGLOBAL(global As %String, outputDir As %String = "")
{
    S Directory="/usr/cachesys/mgr/UMDBDATA"
    if ('outputDir)
    {
        set outputDir = "/home/cache/"    
    }
    
    Set file=##class(%File).%New(outputDir_"GLOBALSIZEPERGLOBAL"_$ZSTRIP($ZU(188),"*CP")_".csv")
    Do file.Open("WSN")
    S Count=1
    S Rset=##class(%ResultSet).%New("%SYS.GlobalQuery:Size")
    D Rset.Execute(Directory,,"*",1)
     While Rset.Next() {
        S Res(Count,"Name")=Rset.Get("Name")
        S Res(Count,"MB")=Rset.Get("Allocated MB")
        
        if (Res(Count,"Name") [ global)
        {
            Do file.WriteLine(Res(Count,"Name")_","_Res(Count,"MB"))
            /*Do file.WriteLine("------------------------------")
            Do file.WriteLine("--GLOBAL-- "_Res(Count,"Name"))
            Do file.WriteLine("--SIZE(MB)-- "_Res(Count,"MB"))
            Do file.WriteLine("-------------------------------")*/
            Do file.WriteLine("")
        }
        S Count=Count+1
     }
     Do file.Close()
 quit $$$OK
}
 
 

I believe on the stream it will be more difficult.