Questions tagged [sort-operator]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
21 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 ...
40
votes
2answers
1k 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
0answers
99 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
1answer
296 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
2answers
900 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
1answer
103 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 ...
11
votes
1answer
10k 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
2answers
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 ...