In this article:

General Information

Description

Error 1

Solution

Error 2

Solution

Caching Dictionary Data

Effective Creation and Use of Dictionaries

Article number: KB000014

General Information

Related blocks:

Description

On creating and using dictionaries in Foresight Analytics Platform, mistakes are often made, which may cause incorrect application work and use of the platform.

Error 1

A dictionary is built based on the table that contains the most entries. Only some records are included into the dictionary as its elements.

Thus, when a dictionary is created, all table records are extracted to the client workstation. Next the records are filtered either using a custom filter or by the developer who is creating the dictionary. This situation happens quite often when a single table stores data for several dictionaries or the data that differ by value of some field.

Extracting a large number of records takes much time. This problem becomes more serious when the system lacks operating memory. Filtering a large number of records is also time-consuming. Both factors lead to significant increase in time required to open a dictionary.

Solution

Creating a dictionary based on the query that filters only the desired records from the table. The query can be a parametric one and it can be controlled from the dictionary. So you can use a single request for multiple dictionary. Filtering data on the server can greatly accelerate construction of a dictionary.

Error 2

Using filter in a dictionary instead of filtering data on the request level.

There is a parametric dictionary. A dictionary should include only the elements with value of a certain field (attribute) equal to the parameter's value. In this case a filter is often applied for the dictionary: value of a field or an attribute should match the parameter's value. When a dimension contains a large amount of elements, checking the condition takes much time, as an expression in Fore is to be calculated for each record of the source table (request).

Solution

Building a dictionary based on a query is similar to the procedure described above. The only difference in this case is that the dictionary parameter is to control the query parameter.

It is recommended to use a filter in the dictionary only for unusual methods of filtering. In other cases it is better to filter values on the level of database request.

Caching Dictionary Data

Platform kernel caches dictionaries including parametric ones. If a dictionary of the application system with a large amount of elements (attributes) opens many times with various paramerters' values, this may cause significant consumption of memory required to store cache. If parameters of Data type are used to manage a dictionary, parameter values should be passed without time component (time component value is to be set to default value 00:00).

This should be taken into account when developing application systems. If you need to constantly reopen dictionaries, it is recommended to clear cache of corresponding object or the entire repository after closing a dictionary. Platform kernel includes various tools for cache management:

See also:

Developers Knowledge Base | IMetabase.Cache | IMetabaseObject.FlushInstance | IMetabaseObject.FlushInstances