Tuesday, March 6, 2012

Report performance of Dynamics AX

Today i've got a task to take a look at a long-running report. I came across the following useful checklist:

Include a try catch around all transactions that could result in deadlock.

Make sure the try for a deadlock is idempotent meaning no matter how many times the try is attempted, it will yield the same result.

Consider the clarity when deciding the number of return statements in a method.

Use throw instead of ttsAbort.

Avoid display methods where possible.

Set Optimistic Concurrency Control (OccEnabled) to Yes for most tables.

Do not include user interaction inside a database transaction.

Keep database transactions as short as possible.

Run code on the Application Object Server (AOS) whenever possible.

Use where clauses in select statements and in queries that align with indexes.

If method calls are used to test conditions, put the method calls after the other conditions. If the other conditions fail, then you will not incur the cost of running the method.

Minimize the size of database transactions.

Consider specifying a field list in select statements to increase performance.

Use firstonly where applicable to increase performance.

Use aggregates in the selection criteria instead of having the code do the aggregation. If aggregations are issued in the select statement rather than in code, the processing is done at the database server which is much more efficient.

Use table joins instead of nested while loops. Whenever possible use a join in the select statement rather than using a while loop and then an inner while loop on the related table. This reduces the amount of communication between the AOS and the database.

Do not include any sort of user interaction in a transaction.
Credit:  eswar, sause


No comments:

Post a Comment