Skip to main content

Indexes

Indexes on views serve the same purpose as indexes on tables — they improve query performance by allowing SQL Server to locate rows efficiently. A view index is defined in the AOT and synchronised to the database as an indexed view (a materialised view in SQL Server terminology) when the view meets the criteria.

note

SQL Server has strict requirements for indexed views: the view must be schema-bound, deterministic, and cannot use certain constructs (outer joins, subqueries, non-deterministic functions). Not all D365 views qualify. When the requirements are not met, the index definition is present in the AOT but may not produce a physical index in the database.

Each index contains one or more AxViewIndexField entries that reference fields on the view.


Valid Time State Support

Like table indexes, view indexes can participate in the valid time state framework. When ValidTimeStateKey is set to Yes on an index, it becomes the key that enforces date-effective behaviour on the view. The ValidTimeStateMode property controls whether gaps between validity periods are allowed.


Properties

12/12 properties
PropertyDisplay NameTypeDescription
IndexAxViewIndex
NameNameStringThe name of the index.
TagsTagsStringTags for this element separated by semicolon.
AllowDuplicatesAllow DuplicatesNoYesWhether the index allows duplicate keys. Values: No (0), Yes (1).
EnabledEnabledNoYesWhether the index is enabled. Values: No (0), Yes (1).
ConfigurationKeyConfiguration KeyStringThe configuration key assigned to the index.
AlternateKeyAlternate KeyNoYesWhether this unique index is part of an alternate key. Values: No (0), Yes (1).
ValidTimeStateKeyValid Time State KeyNoYesWhether this index enforces valid time state behaviour. Values: No (0), Yes (1).
ValidTimeStateModeValid Time State ModeValidTimeStateModeGap behaviour for valid time state. Values: NoGap (0), Gap (1).
Index FieldAxViewIndexField
NameNameStringThe name of the index field entry.
TagsTagsStringTags for this element separated by semicolon.
DataFieldData FieldStringThe view field included in this index.
IncludedColumnIncluded ColumnNoYesWhether the column is an included (non-key) column for covering index purposes. Values: No (0), Yes (1).