That's a general problem of a web interface like this.
You start a query but it isn't finished before your fall into a browser timeout.

An easy workaround:

Start a terminal session (terminals don't know about timeout)
and from prompt run SQl.Shell

or for a multi-line statement just start with an empty line and run with GO

It will wait forever until completed

As these buffers are a (hopefully large) pool that belongs to your whole installation.
They are only cleared if you restart Caché.
But you should probably take a look at your "disk drives" (whatever type they are).
Their performance might be worth to check
[in quotes as they might be virtual in some way]  

In addition, a  performance check with WRC might make sense.
They are top experts to the subject.

If you have a large buffer pool you might run a $QUERY() loop across the whole global
in the morning and hope it stays there long enough. Some installations practice it that way.

  @Evgeny Shvarov 
     Are you looking for something like this ?

this is the related query:

select %vid AbsRef
    , TO_CHAR(Day,'YYYY-MM-DD')  Day
    , Seq 
    , $PIECE($PIECE(p,'$ZE=',2),'>',1)||'>' Type
    , $PIECE($PIECE(p,'>',2),',$ZV',1)||'>' Line
    , $PIECE(p,'$ZV=',2)||'>' Version
 from (
    SELECT TOP ALL
       day, seq, LIST(item||'='||value) p
       FROM zrcc.ERRORStack 
       WHERE Stacklevel=0
       AND item IN ('$ZE','$ZV')
       GROUP BY day,seq
)

out of the experience: every project in ZPM needs its personal package.

otherwise, you may see this:

ERROR #5001: Resource 'rcc.PKG' is already defined as part of module 'echoserver-wsock-iris'; cannot also be listed in module 'iris-internal-websocket-client'
ERROR #6315: FErrors reporting importing XML subelement in file  'C:\InterSystems\IRIS\mgr\.modules\USER\iris-internal-websocket-client\1.0.0\module.xml', at line'3', offset '55'. skipping this item.

Thanks for the hint. 
I was pretty sure there should be something similar to serve SysMgmtPortal. I just didn't know.
Obviously the authors had the same problems as me with the old structure and applied a bunch of custom queries.
I don't think I missed something:
- the class is deployed so you have to accept what it does.
differently  %ERN.int doesn't hide anything and speaks full truth. 
- next to use it you require full access rights to %SYS and a namespace change %SYS to run it.
- and finally the topmost requirement: The queries are invisible to SQL! 
Just because not being exposed as SqlProcedure.

My solution runs in any namespace on Caché / Ensemble / iris .
Without any privileges and doesn't touch any ISC copyrights!