Should we upgrade SQL Server 2016 compatibility from level 100 to 130?

Upgrading the compatibility level of your SQL Server 2016 database from 2008 (compatibility level 100) to 2016 (compatibility level 130) can provide significant benefits, including better performance and access to modern features. However, before deciding, it’s important to carefully weigh the pros and cons.

Reasons to Upgrade Compatibility Level

  1. Performance Improvements
    • Query Optimizer Enhancements: SQL Server 2016 introduces significant changes in how the query optimizer works. This can lead to faster query execution, improved indexing strategies, and better parallel processing.
    • Adaptive Query Processing: You get access to features like memory grant feedback and batch mode for large analytic queries, which help avoid query performance issues.
    • Better Parallelism: More efficient use of CPU cores during complex query processing or index operations.
  2. Access to New Features
    • Advanced Functions: New functions like STRING_SPLIT(), AT TIME ZONE, and TRIM() are available in SQL Server 2016, which can simplify your SQL code and improve readability.
    • JSON Support: If your system interacts with JSON data, SQL Server 2016 offers powerful JSON parsing and querying capabilities (OPENJSON, JSON_VALUE, etc.).
    • Temporal Tables: Allows time-based versioned data, useful for auditing and historical data tracking.
  3. Security Improvements
    • Features like Always Encrypted, Dynamic Data Masking, and Row-Level Security are better supported in SQL Server 2016. They provide enhanced security for sensitive data.
  4. Better Maintenance Operations
    • Parallel Index Rebuilds: Improved index maintenance operations with parallel rebuilds allow for faster and more efficient database maintenance.
  5. Long-Term Support
    • As you transition to using newer features, you future-proof your system, making it easier to adopt updates or upgrades down the line. Compatibility level 130 ensures better longevity for future upgrades or migration paths.

Potential Risks and Considerations

  1. Legacy Code Compatibility
    • Some older queries or features might rely on behaviors specific to compatibility level 100 (SQL Server 2008). There is a small chance that certain queries might behave differently or encounter errors after an upgrade.
    • Certain deprecated features in SQL Server 2008 may no longer work or could function differently in higher compatibility levels.
  2. Testing and Validation Required
    • Before upgrading, it’s important to perform thorough testing of your application and queries to ensure that everything works as expected. Use a staging environment to upgrade compatibility level and run tests to ensure that no performance regressions or breaking changes occur.
  3. Database Features and Stored Procedures
    • Check if any stored procedures, triggers, or other database features depend on SQL Server 2008 behavior. While most features will work seamlessly, some may require adjustments.

Recommended Approach

  1. Test in a Non-Production Environment:
    Before making the upgrade in production, clone your database in a testing environment and change the compatibility level there first. Run all your queries, stored procedures, and applications to check for any issues.
  2. Monitor Query Performance:
    After upgrading, monitor query performance using tools like Query Store (available in SQL Server 2016) to see if any queries perform better or worse and adjust as needed.
  3. Gradual Rollout:
    If your testing shows no significant issues, plan for a gradual rollout of the compatibility level upgrade in production during a maintenance window, and be prepared to roll back if any issues arise.

Conclusion

Upgrading the compatibility level to SQL Server 2016 is generally recommended, as it will allow you to take advantage of better performance, new features, and long-term support. However, the decision should be based on thorough testing to ensure that existing queries and application functions remain stable after the upgrade.

Leave a Reply

Your email address will not be published. Required fields are marked *