Improve an application performance by adding indexes to a database

后端 未结 2 2003
攒了一身酷
攒了一身酷 2021-01-29 01:20

I\'ve got an old web application with a lot of legacy code and I need to improve performance for some reports. I want to avoid reports rewrite, because it\'s standard legacy app

相关标签:
2条回答
  • 2021-01-29 02:01
    1. It's a good idea to improve application performance by improving SQL queries performance if DB is a bottleneck. From information provided above I can say that in your case DB performance is important and worth to improve.

    2. It's possible to significantly improve performance of reports which execute a lot of queries by adding indexes. Especially if tables itself contain tons of records (10 000 and more). But, indexes have their own drawbacks:

      • they slowdown insertions/updates/deletions
      • they influence query execution plan. As a result in some cases DB manager chooses to use index when it would be more appropriate to perform full table scan. Which in turn causes performance degradation.
    0 讨论(0)
  • 2021-01-29 02:09

    For a poor performing database, inappropriate/missing indexes can be ONE of the many reasons.

    If you think not having enough indexes is what causing the poor performance then there are tool to check if the missing indexes is the actual problem, but sometimes problem can be the query itself.

    If your query is written poorly no matter how many indexes you add it will perform poor.

    Sometimes query is written fine and there are enough indexes to support the query but there isn’t enough resources (Memory RAM, processor horse power) to get the job done quickly.

    I would suggest you to investigate your database a bit more before you start adding indexes and introduce more problems which never existed before.

    Some useful links

    1. Are you using SQL's Missing Index DMVs?

      This will allow you to see if there are any missing indexes and queries may gain performance by adding indexes.

    2. Wait statistics, or please tell me where it hurts

      This blog written by Paul Randal will help you to see exactly what is causing slow performance in your sql server. Whether it be your hardware or indexes or queries.

    3. Most Expensive Queries

      This will allow you to see the most expensive queries in your database, I would go query by query and try to improve the code (if possible) and also check if any index can help the query to reduce its cost.

    Import Note

    Performance tunning in sql server is no simple task and there is no silver bullet for it either, you will need to investigate more to find the actual bottlenecks in your database and target them, and with each change do a comparison that how that change has impacted your database performance. Good luck with that :)

    0 讨论(0)
提交回复
热议问题