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.
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
| Property | Display Name | Type | Description |
|---|---|---|---|
| IndexAxViewIndex | |||
| Name | Name | String | The name of the index. |
| Tags | Tags | String | Tags for this element separated by semicolon. |
| AllowDuplicates | Allow Duplicates | NoYes | Whether the index allows duplicate keys. Values: No (0), Yes (1). |
| Enabled | Enabled | NoYes | Whether the index is enabled. Values: No (0), Yes (1). |
| ConfigurationKey | Configuration Key | String | The configuration key assigned to the index. |
| AlternateKey | Alternate Key | NoYes | Whether this unique index is part of an alternate key. Values: No (0), Yes (1). |
| ValidTimeStateKey | Valid Time State Key | NoYes | Whether this index enforces valid time state behaviour. Values: No (0), Yes (1). |
| ValidTimeStateMode | Valid Time State Mode | ValidTimeStateMode | Gap behaviour for valid time state. Values: NoGap (0), Gap (1). |
| Index FieldAxViewIndexField | |||
| Name | Name | String | The name of the index field entry. |
| Tags | Tags | String | Tags for this element separated by semicolon. |
| DataField | Data Field | String | The view field included in this index. |
| IncludedColumn | Included Column | NoYes | Whether the column is an included (non-key) column for covering index purposes. Values: No (0), Yes (1). |