Sql-server – Warning in Execution Plan

execution-plansql servert-sql

I have a T-SQL query with four inner joins, I executed the query in SSMS with Actual Execution Plan selected. When I review the generated plan I saw the warning icon on Sort operator.
What is the reason for this warning in Sort operator?

The Query Plan URL: https://www.brentozar.com/pastetheplan/?id=HJULL9H4N

I provided the screen shot of Execution Plan.
enter image description here

The Warning:
enter image description here

Best Answer

What is the reason for this warning in Sort operator?

You can see the warning description in properties of the element. I'm sure you will see information like below:

Operator used tempdb to spill data during execution.....

It means that memory which was granted for the query turned out to be less than it needed. Two possible reasons for that:

  1. Wrong cardinality estimation so the query asked for the less memory grant than it really needed
  2. Lack of memory so the query asked enough memory but got less

Detailed information about memory grant can be found in the properties window of SELECToperation from your query plan.