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

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

    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.

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

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

  • Verified answer
    Jonathancm Profile Picture
    Jonathancm 416 on at
    RE: Indexes - must they always have partition as the first column?

    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/

  • Verified answer
    Daniel Weichsel Profile Picture
    Daniel Weichsel 1,657 on at
    RE: Indexes - must they always have partition as the first column?

    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.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,436 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans