Sunday, August 9, 2015

Index

Index:

Indexes are used to improve the database search and retrieve functionality. We can add one or more fields in the indexes. Indexes are managed automatically by the DBMS when we do the operation insert, update and delete. We don’t want to create the index if the table mostly used for insert the values. Index is right choice for tables that mostly using for search functionality. We can’t create index for the datatypes memo and container fields. In AX 2012, all tables having default index for the fields recid and dataareaid.

Two types of indexes are in AX 2012.
  1. Unique
  2. Non unique

Unique:

We can unique index by setting the property AllowDuplicates to Yes. Once we created the unique index for the fields, we can’t insert duplicate value, the system will handle automatically and throw error message when we insert the duplicate values. We can select the unique index as table primary index.

Non unique:

It allows duplicate values.

We can enable and disable the index by setting the index property Enabled. DBMS will handle index once you re-enable the index. We can also delete the index.

We can use the index in the select statement to improve the fetching speed. For example

while select AccountNum, Name from custTable index AccountIdx { ……. }