web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Indexes - must they always have partition as the first column?

(0) ShareShare
ReportReport
Posted on by

I'm trying to improve the performance of a form that relies on data in the TransactionLog table. If I create an index using t-sql, I get adequate performance

CREATE NONCLUSTERED INDEX [myIndex] ON [dbo].[TRANSACTIONLOG] (

    [TYPE] ASC,
    [PARTITION] ASC,
    [CREATEDTRANSACTIONID] ASC
)

If I create the index in AX, I get columns in a different order (and an extra column for company), and performance is terrible.

create nonclustered index [I_482TYPETRANID] on [dbo].[TRANSACTIONLOG] (

    [PARTITION] asc,
    [DATAAREAID] asc,
    [TYPE] asc,
    [CREATEDTRANSACTIONID] asc
)

Is there any way to force AX to arrange the index's columns in a particular order?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Daniel Weichsel Profile Picture
    on at

    Hi Seth,

    You can add the Partition and DataAreaId columns to the index definition in the AOT, and then that order will be respected when synchronized to the database.  You won't be able to leave out the DataAreaId column (since AX will automatically add it back in), but this way you can at least adjust the position of the DataAreaId column in the index.

  • Verified answer
    Jonathancm Profile Picture
    416 on at

    Hi Seth,

    As Daniel said, you can add partition, dataareaId and recid within the index definition in AX-AOT, this way you will be able to make your own order of the fields. You cannot get rid of those fields, but you can put them in another order. 

    This is one of the most common performance issues, since most of the implemantations only have less than 10 companies... sometimes only one. Most of the times only one partition. So this cause those indexes to have an utterly poor performance over time. 

    As you know if you does not create an index for a table, AX creates an iunique index in SQL, with Partition, DataAreaId and RecId. 

    Please take a look at this blog post for more information:

    https://daxnigel.wordpress.com/2014/10/18/index-field-order-performance-tuning/

  • Community Member Profile Picture
    on at

    Thanks Daniel. It seems very straightforward once I think about it.

  • Community Member Profile Picture
    on at

    Does anyone has ever do a job X++ to re-order all the index of all tables in AX ? 
    Since we have only 1 partition and 1 company, all those index automatically containing Partition and DataareaId at first in the index is really bad for the statistics SQL and the performance of many queries could be much better if the indexes was re-order.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans