Performance points in axapta
How you code access to your data has a major impact on the performance of your code and system; here is a list of rules to go by:
• Unless you really need to and have tested the execution plan very well, don’t use hints in database statements; the database optimizer will do a better job, and a bad hint can really hurt performance.
• Use table joins instead of using loops to walk through your data; this reduces the number of statements traveling around and the amount of data, plus it offloads processing of data to the database.
• Use aggregate functions where appropriate instead of aggregating in code.
• If you are deleting many rows that match specific criteria, use the delete_from statement instead of delete, as it performs better.
• If you are updating many rows that match specific criteria, use the update_from statement instead of the update statement, as it performs better.
• Think well about your indexes: lack of good indexes will lead to full table scans.
• Sort data using indexed fields and avoid conflicts between where and order by clauses.
• Write where clauses that select only the data you need.
• Minimize the time records are locked by not hanging on to data longer than necessary— i.e. don’t select some data for update, do a bunch of other stuff, and then use it sometime later.
• Use recordset functions where possible, such as array insert, insert recordset, and update recordset.