Queries have been running really slowly since upgrading the database to SQL Server 2025.

Amin 10 Reputation points

After upgrading my SQL Server from versions 2014 and 2022 to 2025, the queries have become noticeably slower.

  1. Viorel 127K Reputation points

    Is it a query that does not return many results?

  2. Erland Sommarskog 134.7K Reputation points β€’ MVP β€’ Volunteer Moderator

    Did you also change the compatibility level from 120 to 170?

    A good way to handle issues like this:

    1. Keep compat level to 120.
    2. Enable Query Store.
    3. Run with compat level 120 a week or two.
    4. Flip to 170.

    You can now use Query Store to find regressed queries. and as a quick solution you can force the old plan.

    You can also use the Tasks context menu for the database. At the bottom of the menu, you find Database Upgrade which helps you with the steps I outlined above.

  3. Amin 10 Reputation points

    I noticed that when I use SQL Server Authentication, this problem occurs. When I add Trusted_Connection=True, the queries run normally; otherwise, they become really slow.

  4. Erland Sommarskog 134.7K Reputation points β€’ MVP β€’ Volunteer Moderator

    While that is a hint, it is not sufficient to tell you what the issue is. It could be that there is an issue with SQL logins in SQL 2025, but I find it more likely that is a performance issue related to row-level security or similar.

    You need to track down which queries that actually are slow.

  5. Amin 10 Reputation points

    Everything was working fine with SQL Server 2022 (Windows or SQL Authentication mode), but this problem just happened in SQL Server 2025 using SQL Authentication mode!


Sign in to comment

1 additional answer

  1. AI answer

    After upgrading your SQL Server to version 2025, it's not uncommon to experience slower query performance. One potential cause could be related to changes in the Cardinality Estimation (CE) model that were introduced in SQL Server 2014 and continued in later versions. If your queries were optimized for an earlier version, they might not perform as well under the new CE model.

    Here are some steps you can take to troubleshoot and potentially resolve the slow query performance:

    1. Examine the query plan: Look at the execution plans for the slow-running queries to identify any inefficiencies.
    2. Update Statistics: Ensure that the statistics for your tables are up to date, as outdated statistics can lead to poor query performance.
    3. Identify Missing Indexes: Use the SQL Server Dynamic Management Views (DMVs) to find any missing indexes that could improve performance.
    4. Rewrite Queries: Consider redesigning or rewriting the queries that are running slowly to optimize their performance.
    5. Check Compatibility Level: Ensure that your database compatibility level is set appropriately for SQL Server 2025. Sometimes, reverting to a previous compatibility level can help improve performance until you can optimize the queries for the new version.

    If all queries are running slower after the upgrade, the troubleshooting steps may differ, and you might need to investigate further into the specific causes of the performance degradation.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.
Sign in to answer

Your answer