How to change length of variable

I measure the maximum variable length in Asterisk 13 at 4090.

; channel variable length test
        same = n(loop),                 set(t=${t}b)
        same = n,                       verbose(${LEN(${t})})
        same = n,                       wait(0.01)
        same = n,                       goto(loop)
        same = n,                       hangup()

Maybe storing a key to a row in a database would be a better approach?