Before we discuss about fine-tuning the performance
of the database for Dynamics NAV, it is important to discuss some key
features of the Dynamics NAV application that comprise the core
architecture of the application, and the majority of performance issues
could be attributed to improper use or misuse of these features.
SIFT
In the Classic database server option, SIFT (Sum Index Flow Technology)
is used to make the calculation of balances, sums, and so on. In any
other database, this is normally done through calculations and could be a
time-consuming process if there are thousands of records in the table.
The SIFT data is stored in indexes, which are also called secondary keys
in the Classic database server option. The balances based on the
"secondary keys" are stored in separate indexes in the database. The
programmer can define which fields need calculation by defining the SumIndexFields
for the keys, as represented in the following screenshot. Therefore,
the retrieval time for things such as account balances and such others
is minimal, making the application extremely fast:
What gives a boost to SIFT is
the ability to filter on the underlying values that make up SIFT
balances. This technology is also known as the flow filter technology, which complements the basic SIFT technology in a significant way.
When SIFT was initially
implemented on the Microsoft SQL Server database option for Dynamics
NAV, it was done by storing these SIFT columns in summarized tables
called SIFT tables
that were continuously updated through SQL triggers. Thus, the
procedure was expensive and took a toll on the performance when a table
containing SIFT indexes was updated.
From the Dynamics NAV 5.0
Service Pack 1 version, Microsoft decided to use indexed views in SQL
Server instead of SIFT tables. Dynamics NAV creates one SQL indexed view
per key, regardless of how many sum indexed fields there are in that
key. Having too many SIFT indexes can adversely affect the performance
of the application.
Having too many fields in the SIFT indexes is also not advisable.
The MaintainSIFTIndex
property of the index in the base table could be used to optimally
design the SIFT indexes. If there is the possibility of the base table
not growing so rapidly, it is recommended to keep the MaintainSIFTIndex property to No.
For more information about SQL indexed views, we can refer to the Microsoft SQL library.
Using indexes/keys in Dynamics NAV
Maintaining indexes
for Microsoft Dynamics NAV has also been seen as a big performance
issue. This is one of the major reasons for performance issues in the
Dynamics NAV Classic database. The Microsoft SQL Server is clever enough
to sort the data without any index, if the dataset being sorted is not
huge.
To access these properties of the keys, go to Object Designer, highlight the table in which the key needs to be modified, click on Design to open the list of fields in the table, and go to View | Keys. A window similar to the following screenshot opens, showing the list of keys:
To open the properties of a particular key, highlight the key and then click on View | Properties, as shown in the following screenshot:
These indexes or keys could be used optimally by using the following properties of the keys:
Enabled: This
is a property to enable or disable an individual key. A lot of times,
developers create a one-off key to be used in a particular report or
another piece of customization. This one-off key can be disabled or
enabled based on the utilization or frequency of the use of
customization.
SumIndexFields: This property is used to define the SumIndexFields (whose sum needs to be maintained in the SQL indexed views). A maximum of 20 can be selected. SumIndexedFields
KeyGroups: This is a method of combining the various keys together so that they could be enabled or disabled together.
For example, in the
following screenshot we see that the, Key Group property is defined as
Consol, which is one of the key groups in the database.
Keys can be combined together based on the nature of the use of keys or a particular application area.
To enable or disable a key group, go to File | Database | Information. Click on the Key Group button in the bottom of the Database Information form to open a list of key groups defined in the database.
MaintainSQLIndex:
Microsoft SQL Server is clever enough to sort the data without an
index, though to have the SQL Server sort faster, an index of the fields
to be sorted can be created. Any writes to the table will be slower, as
the number of indexes in a table grows, as those indexes will have to
be updated along with each write transaction.
MaintainSIFTIndex: We need to set this property to No if the data to be maintained in the SIFT base tables is less.
Clustered:
This is where we define whether or not the index is clustered. Clustered
indexes are used to specify the sorting of data as it pertains to the
storage in the table.
In Dynamics NAV and also in a SQL Server database, a primary key is a clustered index by default.
SQLIndex: We can specify here the actual list of fields that need to be a part of the SQL index.