prashanth ponugoti · Oct 8, 2022

How much memory will it take to use maxlen for String type?

Hi Friends,

If I created Property as below

Property Abc as %String (Maxlen = 3000000)

how much space will be used in cache DB, if assigned "hello" to Abc?

The cache will use 3000000  bytes or  5 bytes?

This conformation is very important for my implementation



Product version: IRIS 2022.1
0 149
Discussion (3)1
Log in or sign up to continue

For a string like "hallo" Cache will use 5+2 = 7 bytes. If that "hallo..." is longer then 253 bytes then length_of_string + 4 bytes will be used and if your "hallo..." is longer then 65535 bytes then length_of_string + 6 bytes will be used.

But there is one more thing, you should know: the sum of the lengths of ALL properties, except the array(like) properties, can't be greater then that famous 3641144 magic number (if you use the standard Cache Storage). Array-like properties are those, which are stored in own nodes.

Hi Prashanth,

It is possible to view how this is stored.

Consider the following class definition.

After compiling its default Data Storage location is global: ^TEST.PropertyLenD

Class TEST.PropertyLen Extends %Persistent
Property Abc As %String(MAXLEN = "");
Property Def As %String(MAXLEN = "");

Storage Default
<Data name="PropertyLenDefaultData">
<Value name="1">
<Value name="2">
<Value name="3">
} }

Creating a record:

USER>s o=##class(TEST.PropertyLen).%New()
USER>s o.Abc="Hello"
USER>s o.Def="World!"
USER>d o.%Save()
USER>w !,"RowId is ",o.%Id()
RowId is 1

Then viewing the record

zw ^TEST.PropertyLenD(1)

So by default there is a single global data node made from a list of all property values.

This can also can be viewed in System Management Portal -> System Explorer -> Globals:

Kind regards,