Questions tagged [sort-operator]
The sort-operator tag has no usage guidance.
9
questions
0
votes
1
answer
39
views
What makes the optimizer insert a sort operator in the plan
What are the reasons that the optimizer chooses to insert a sort operator in the plan (to satisfy a stream aggregate or a merge join, etc.) instead of going for hash match or hash join?
I have now see ...
1
vote
1
answer
29
views
Azure SQL Server - Cannot get rid of the sort operator
I'm using Azure SQL Server (Microsoft SQL Azure (RTM) - 12.0.2000.8 Apr 3 2019 13:27:00 Copyright (C) 2019 Microsoft Corporation), Premium tier 4 (500 DTUs).
Query: offer progress has a history ...
43
votes
2
answers
2k
views
Why does changing the declared join column order introduce a sort?
I have two tables with identically named, typed, and indexed key columns. One of the them has a unique clustered index, the other one has a non-unique.
The test setup
Setup script, including some ...
2
votes
0
answers
240
views
SORT(DISTINCT) :Is it because of Kitchen sink queries?
One of the SQL queries I am working on is slow in performance. I have been trying to fix it for the last two days, unsuccessfully. The query is generated from an application (Linq to sql -EFF), and ...
1
vote
1
answer
604
views
Poor performance by LINQ to SQL generated query execution plan
Can you please check the attached execution plan from my SQL Server 2016 and suggest me where to improve.
The query is generated from the .Net application using LINQ to SQL.
I can see large sort ...
4
votes
2
answers
1k
views
left outer join - sort operations in the query plan - any ways of tuning this simple query?
while working on the query below in order to answer this question:
How to query chart data in a database agnostic way?
Having the following tables:
CREATE TABLE [dbo].[#foo] (
[creation] DATETIME ...
2
votes
1
answer
194
views
How can I update statistics adding the data of the last day only?
I have been tuning some queries that had a warning on the sort operator, which is generally an expensive operator:
Operator used tempdb to spill data during execution with spill level 2
The way to ...
25
votes
1
answer
26k
views
Operator used tempdb to spill data during execution with spill level 2
I am struggling to minimise the cost of sort operation on a query plan with the warning Operator usedtempdbto spill data during execution with spill level 2
I have found several posts related to ...
1
vote
2
answers
4k
views
Estimated Execution Plan SQL Server Sort?
I'm running a query and its taking a age to execute, looking at the execution plan I can see that 51% of the cost is in the SORT? when in the actual query i am not ORDERING BY anything.
Anyone got ...