When to use "retain rows"?

When you query a table, you have the option to check “retain rows”. I’m wondering when people use this, where the cache is stored, and when (if ever) the cache is renewed.

In our example, we have a rather big DB table of articles that I want to use to populate a dropdown list. This table is quite static, so I’ve disabled polling on it. And it also doesn’t depend on bindings from the UI.

I think that “retaining rows” would be a good option here, as then the query isn’t executed every time the window is executed.

But when does the data get updated? What happens after a few years, when the table contents may have changed a lot compared to the original data? Is the cache updated when new data is discovered, or will it always return the rows as stored in the designer first?

Retain rows just means that when the component first starts up, it will be populated with the dataset that was saved into it in the designer.
Even with polling off, any bindings on your screen will run when the window first opens - the biggest difference ‘Retain Rows’ usually has is that it can dramatically improve save times in the designer, since we don’t have to serialize potentially massive datasets and store them to the internal DB.

1 Like

If you need similar behavior in a situation where the dataset comes from some other source, you can use the toTransient() expression function or scripting function from my Time Series Caching module.
The difference in startup times and the difference in project backup sizes are astonishing if you are handling large datasets in your windows.

1 Like

FWIW, only the actual caching functions in the TS DB Cache module check the module license state – you can use the above functions without purchasing the module.

1 Like