New Lazy Loading Feature


We have added a new ability to InMemory.Net called Lazy Loading. It is designed to help reduce memory usage, by only loading those columns, that are actually used by SQL queries.

The default behaviour in InMemory.Net is to load the entire database file into memory. However, with the lazy loading feature, the database will load columns, on demand, when they are needed. If a column is never used, then less memory is used, because that column never needs to be loaded.

There is a potential small trade off in performance, because a column will need to be loaded before it can be used in a query. Also the lazyload feature will use disk space in your data directory to store temporary copies of the irdb data files. A temporary copy is needed, so the original is not locked, and can still be updated. For an irdb file, to support lazyloading, it needs to have been saved with a build later than December 2019.

To use lazy loading, in the InMemory.Net server process, you need to add LazyLoad=true to the irdb.ini file and restart the server. In the default mode when using lazy loading, columns will stay loaded. However if you would like to unload columns, after a period of not being used, you can add the option lazyload_unload_column_timer=15 to irdb.ini to tell it unload inactive columns after 15 minutes from memory.

IRDB Query now has a separate menu option to open a database in lazy load mode.

To use the lazy loading feature in irdbImport, you add a lazyload keyword when declaring your datasource. e.g.
DATASOURCE A1 = LAZYLOAD local irdb ‘c:\irdb\data\mydatabase.irdb’

By default the lazyloading is not turned on, and needs to be actively enabled.

%d bloggers like this: