web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
New Discussion

SQL Performance tuning as a DBA for BC on-prem

(0) ShareShare
ReportReport
Posted on by 5

I am a database administrator who supports a SQL 2016 instance for an on-prem Business Central install.

Several years ago I supported a few SQL instances for AX and GP installations at a number of client sites, but they were always handed to me configured by the ERP consultant with the relevant settings and maintenance jobs configured to the specific needs of the application. I was vaguely aware of several trace flags that were implemented at that time and very low fill factor specified, but otherwise my responsibility was for the most part only to ensure the necessary jobs ran and the database was backed up. Performance problems were always resolved by the consultant.

I have been looking now for specific performance configurations for BC and haven't found much on the SQL side.

A recent issue has been a lot of blocking almost exclusively through update locks with a small amount of contention in shared (read) locks.

Is it the case with BC that indexes must be managed by BC or can I create them myself? If I remember correctly, indexing in a SQL instance serving AX or GP caused some sort of problem. When I review the indexes that are in database currently, all of them look like they were created by some sort of ORM based on the naming.

I have almost 30 tables that have between 10 and 17 indexes about 2/3 of which have 5-9 key columns. I would normally try very hard to not put even 7-8 indexes on a table in a typical mixed OLTP/OLAP application database and keep it at most 4-5 key columns unless there was a really compelling performance reason to risk the insert performance, let alone in an application that is extremely sensitive to insert update and delete performance. I can see from index usage statistics that most of these indexes either have never been used or are rarely used. could these indexes be contributing to some of the blocking?

Should I be rebuilding indexes with lots of empty pages? SQL generally doesn't benefit from leaving empty pages anything past SQL 2005 but am curious if there is something particular about the way BC writes to SQL that could benefit from it.

Another issue I am seeing is that some of the queries BC generates are very inefficient. There are queries that scan millions of records then filter them down to as little as a single result. I have a lot of select statements that are taking out update locks that cause blocking. I am not sure what my question about that is, other than asking for general advisement on query tuning in BC.

We recently did a big posting of several thousand invoices and even after hours when not a single other user was in the system we still received heavy blocking.

There is no memory, cpu or disk pressure reported by the SQL server, all of the waits are waiting on locks.

Sorry if this was rambling, I just don't know what I need to ask or look for in this.

  • Inge M. Bruvik Profile Picture
    1,105 Moderator on at
    RE: SQL Performance tuning as a DBA for BC on-prem

    This is a really big topic and there is a lot to say about it.

    I would recommend this book: www.amazon.com/.../3837014428

    It is a bit old but a lot of thing there is still valid for NAV on prem.

    I also have some recommendations from Microsoft that are some years old. But I will have to go through my archive to find them.

  • YUN ZHU Profile Picture
    95,307 Super User 2025 Season 2 on at
    RE: SQL Performance tuning as a DBA for BC on-prem

    Hi, we have re-indexed for customers and this has improved database performance. You can copy the database to test it in a test environment.

    Microsoft released the In-client performance profiler function in BC20, you can use it to see whether it is a custom problem or a standard problem.

    More details: https://yzhums.com/23121/

    And, the following data comes from a seminar given by Microsoft last year.

    Microsoft feels that most performance issues are caused by customizations.......

    pastedimage1675383917883v1.png

    Hope this can give you some hints.

    Thanks.

    ZHU

  • CreateNonClusteredIndex Profile Picture
    5 on at
    RE: SQL Performance tuning as a DBA for BC on-prem

    Can guidance for NAV generally be used as a baseline for SQL configurations for Business Central then?

  • CreateNonClusteredIndex Profile Picture
    5 on at
    RE: SQL Performance tuning as a DBA for BC on-prem

    Thank you, this is fantastic

  • Inge M. Bruvik Profile Picture
    1,105 Moderator on at
    RE: SQL Performance tuning as a DBA for BC on-prem
    [quote user="CreateNonClusteredIndex"]

    Can guidance for NAV generally be used as a baseline for SQL configurations for Business Central then?

    [/quote]

    Yes, it can.

    A lot of the guidelines is general for the SQL server. And the database model in BC and Dynamics NAV is very much the same.

  • MahGah Profile Picture
    15,529 on at
    RE: SQL Performance tuning as a DBA for BC on-prem

    Also, look into below tools. It is from the author of the book

    www.stryk.info/.../toolbox.html

    www.stryk.info/.../magic7.html

  • CreateNonClusteredIndex Profile Picture
    5 on at
    RE: SQL Performance tuning as a DBA for BC on-prem
    [quote user="MahGah"]

    Also, look into below tools. It is from the author of the book

    www.stryk.info/.../toolbox.html

    www.stryk.info/.../magic7.html

    [/quote]

    Cool. I have some tools I use for all my other DBA work that is very similar to the Magic 7 set, I just haven't known what indexes were safe to remove or modify or if adding indexes outside of BC would create problems for the app similar to the way a code first DB would.

  • Inge M. Bruvik Profile Picture
    1,105 Moderator on at
    RE: SQL Performance tuning as a DBA for BC on-prem

    In general I would recommend to create indexes inside of BC. But SQL server will use the indexes as needed no matter where they have been created. I find it generally safer to create them inside BC.

  • CreateNonClusteredIndex Profile Picture
    5 on at
    RE: SQL Performance tuning as a DBA for BC on-prem

    That book was an excellent recommendation.

    SQL servers facing ERP systems have always been a little mysterious to me with my ERP partners making a big deal about how they were specially configured, but that book has made it clear that they are mostly just regular SQL servers with a small number of minor settings that wouldn't be configured in a more typical mixed oltp/olap workload.

    Some of the settings recommended are pretty old but are fairly easy to figure out whether they are still relevant in SQL 2016+.

    Something that he recommended for small to medium deployments that Microsoft now recommends against, is to disable automatic statistics updates and instead do a daily full scan stats update. I had statistics updates happening so often that I wasn't sure what I was or wasn't seeing in the plan cache after recompiles, but based on the limited data I have it may have improved performance slightly? Typically, I would not do such regular statistics updates to avoid parameter sniffing problems, but I noticed almost everything BC does uses 'OPTIMIZE FOR UNKNOWN' which should help avoid that.

  • MahGah Profile Picture
    15,529 on at
    RE: SQL Performance tuning as a DBA for BC on-prem

    Hi CreateNonClusteredIndex

    Thanks for sharing back your experience. I think if you can quickly touch base on changes in SQL 2016+ (like really high level) can help future reader as well. I mean if someone find this post then they can get a good idea of what they need to do. I know you are busy and may not have time for it. But if you can it will help a lot.

    Or you can write a new post here and publish that as well

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,377

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,696 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,512 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans