Dedupe and eliminate indexes for Microsoft Dynamics AX 2009 and AX 2012 environments - query-optimization

Have anyone experience with index deduping and also eliminating unused indexes for the Dynamics family of applications? Using a SQL Agent job, every evening to disable these indexes if they are enabled.
Tried for some indexes, but not for a many at the same time. Have not got any feedback from users for these changes.

Related

Do re-indexing of database runs automatically with CRM app?

It's my first time using CRM as an app. I have been using SQL Server for quite a while now. Our company is experiencing issues with emails, thus having warnings in event viewer
Query execution time of 17.3 seconds exceeded the threshold of 10 seconds.'
for almost all select statements.
My main concern here is I am in doubt that the CRM job tool for reindexing is not running properly. Also, I have checked the reindex maintenance plan in the SQL Server, no configurations were made for reindex.
I hope someone can help me. Thanks!
In Dynamics 2016 On Premises you are free to create and maintain your own indexes. What is needed really depends on how your company is using the system. Sometimes recalculating statistics does the trick (as far as I remember this is part of the built-in maintenance jobs), sometimes you may even want to partition the database.
E-mail storage in MS Dynamics can quickly grow out of hand, because attachments (e.g. these colorful company footers) use to take up a lot of valuable database space. Decide what e-mail really needs to be tracked, if attachments and images can be stripped from them or if they can be stored in a separate file group. (To mention a few options.)
Poor SQL Server management is actually often the ground reason for performance issues on MS Dynamics. Your skills will be of much value!

How to measure the performance of the Azure SQL DB?

I need to measure the SQL Azure DB performance using DTA, is it possible or not, if not what is the workaround to consume a workload file (.trc)??
Database Engine Tuning Advisor does not support Azure SQL Database. It is also not possible to create a trace file from an Azure SQL Database using SQL Server Profiler.
SQL Azure automates the creation of indexes that may improve performance of your workload with a feature named automatic tuning. Automatic Tuning on Azure SQL also drops redundant indexes and uses the best execution plan for queries
Alberto is correct - there are features within SQL Azure which help watch and improve the performance of your database queries automatically in some cases. Profiler trace + DTA are not currently supported in SQL Azure. The DTA (Database Tuning Advisor) feature in SQL Server is very good for taking traces and trying to replay them on a different server to simulate possible index and partitioning changes which could improve your performance. The automatic tuning feature does that for you without having to use DTA today yourself.
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-automatic-tuning
If all you want to do is explore the performance of your database, then you can use the query store in SQL Azure (and SQL Server 2016+) to do this kind of analysis.
https://azure.microsoft.com/en-us/blog/query-store-a-flight-data-recorder-for-your-database/
https://learn.microsoft.com/en-us/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store?view=sql-server-2017
If you have not tried this using a recent release of SQL Server Management Studio(SSMS), then I highly suggest you download this and try it. You can see top N queries by different metrics, plan changes over time, and other metrics which give you faster insight into the performance profile of your database + application.
There is no way to take a .trc file today and examine it in the query store, but you can enable query store in an on-premises SQL Server (2016+) and then record your production workload for awhile to see how it is behaving. Please understand there is an overhead to running with the query store on - usually it is modest, but for highly ad hoc OLTP query workloads you may see larger overhead. There are some knobs to tune this, so please just go through normal due diligence before modifying a production system. If you have problems, turn it back off and re-examine until you have the right settings to help capture the relevant data from your workload to help make tuning decisions.
Hope that helps!
Sincerely,
Conor Cunningham
Architect, SQL

Safest way to apply changes recommended by sql query on CRM Dynamics

I am new to CRM, trying to help our CRM team to make our CRM application faster. We have on-premises 2015 version.
I ran the stats query on CRM DB, there are more than 1000 indexes having more 30% avg_fragmentation.
what is safest way to resolve this issue? can we do this in Live CRM DB or can we create a copy of Live CRM DB and do on the live again? and another question is how to create live copy and manage in such way so that whenever main DB is down it goes to live copy and keep application running?
PLEASE Help.
Creating and de-fragmenting indexes on the CRM database are supported operations. Microsoft recommends that indexes with a fragmentation level greater than 30% be rebuilt, while those with greater than 10% fragmentation should be reorganized.
Defragmenting your production indexes is perfectly safe but you should run the operation overnight to minimize any affect on system performance.

Why would my Azure SQL Database performance suddenly drop?

I had a 'Business' edition SQL database that started timing out about the same time MS announced the rollout of new SQL features.
Suspicious timing aside, a simple COUNT(*) query against one of my tables is taking nearly 2 minutes. It's got about 4.5 million rows which is about the same row count as another 'Web' tier database that is returning COUNT results in about 1 second. These two databases are on the same server in Azure.
Assuming the worst 'noisy neighbor' scenario, I renamed the DB, copied it and migrated it to Standard S1 tier. I'm having the same performance issues on the new database. I'm not sure what else to try and I'm not sure why my performance fell off a cliff so suddenly.
Any suggestions or 'me too' would be helpful. Thanks!
I don't believe Microsoft have suddenly reduced Business Edition performance. I have performed a series of tests against Business Edition, in both July 2014 and January 2015 and compared. Some aspects of performance seem more volatile now, but not definitively less than in July 2014. See my blog post for details:
https://cbailiss.wordpress.com/2015/01/26/has-azure-sql-database-business-edition-got-slower/
In addition, if you were having performance problems in Business Edition, then Standard S1 in the new service tiers is unlikely to provide sufficient performance. Databases with heavy workloads in business edition will likely need Premium P1 in the newer service tiers. S2 may be sufficient for moderate workloads. I have a series of performance tests on my blog, e.g. see:
https://cbailiss.wordpress.com/2014/12/17/azure-sql-database-v12-performance-tests-show-significant-performance-increase/
Finally, Microsoft have released a new version of Azure SQL Database - v12. v12 is currently in preview but offers significantly better performance compared to v11. It also has a new performance level, S3, which looks like it will provide a better price/performance match to Business Edition. Again, see the above blog post for details.

Azure Database Query Optimizer using View Indices

SQL Server Enterprise Edition's query optimizer will use indices from a view to increase performance of a query even if the view is not explicitly referenced in the query, if applicable. Question: does Azure Database do the same thing? I know SQL Server Express does not do this, for example. I want to ensure I can still get the performance I need from the query optimizer when doing a sort on a joined table with a few million users (works great on enterprise edition but takes several seconds on express - bottle neck at the sort).
Sometime last year (2012) Microsoft announced that the engine was the same between SQL Server and SQL Azure (now called Windows Azure SQL Database :/). So you will likely get the same behavior. Same performance may be another question. Windows Azure SQL Database is also keeping replicas in place in the event of hardware failure. You get the benefit of the secondary coming online in a fashion that is seamless to you. But, This does have a bit of a performance cost. Also, the SQL running in Windows Azure is running in a shared environment. It is pretty well documented that the performance is not the same as a local dedicated multi-processor machine with fast storage. It is a bit of an unfair comparison multi-user, multi-instance vs. dedicated. For many applications this is fast enough, but not all.

Resources