You can see this SQL Server 2017: SQL Sort, Spill, Memory and Adaptive Memory Grant Feedback fantastic article for more details about the tempdb spill issue. The reason for this: the memory always faster than the tempdb database because the tempdb database uses the disk resources. This mechanism is called a tempdb spill and causes performance loss. However, this consumption estimation can be wrong for a variety of reasons, and if the query requires more memory than the estimation, it uses the tempdb data. When we hover the mouse over this operator, we can see the warning details.ĭuring the execution of the query, the query optimizer calculates a required memory consumption for the query based on the estimated row numbers and row size. On the other hand, a warning sign is seen on the Sort operator, and it indicates something does not go well for this operator. To overcome this issue, we can disable or remove the index before executing the update query. In particular, we should consider this problem if we will update a large number of rows. As a result, if the updated columns are being used by the indexes, like this, for example, the query performance might be affected negatively. We have seen this obvious performance difference between the same query because of index usage on the updated columns. The Index Update and Sort operators consume 74% cost of the execution plan. The following execution plan is demonstrating an execution plan of the same query, but this query was completed within 130 seconds because of the added index, unlike the first one. We added a non-clustered index on Persons table before to update and the added index involves the PersonCityName and PersonPostCode columns as the index key. This query was completed within 68 seconds. The only difference is that this query updated the 3.000.000 rows of the Persons table. The following execution plan illustrates an execution plan of the previous query. Particularly, if we are working on the performance of the update query, we should take into account of this probability. Indexes are very helpful database objects to improve query performance in SQL Server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |