Too many joins in query

In Dynamics AX 2012, if you are running a query with too many joins you can get an error or warning message saying “The number of joins in the statement is XX.  This exceeds the maximum of 26.  Turn on exception for this warning to see the call stack.”


So what is this, and what can you do about it?

Continue reading “Too many joins in query”

Implementing checkpointing in long-running updates

Occasionally we need to run updates or inserts of large numbers of records, something which has this nasty habit of taking out locks that will prevent other sessions from updating or inserting in the same tables.  Also, if we terminate such an operation, we’ll have to start all over again from the beginning, wasting a lot of time.

Luckily, with Read Committed Snapshot Isolation which is supported by AX, readers will not be blocked by writers, but writes will still be blocked by other writes.  Once SQL Server escalates the row-level locks to table-level locks things start to go downhill rather quickly, and as we’re pretty much guaranteed not to have an outage window in which to run the update operation, someone is going to be on the phone soon.   Quite soon…

The solution is to break the operation into smaller transactions.

Continue reading “Implementing checkpointing in long-running updates”