All Questions
Tagged with performance sql-server
3,139
questions
3
votes
1
answer
58
views
Why is Query Optimizer Underestimating and Causing Data Spill to tempdb?
I have a very simple query that I am testing by running ad-hoc.
The execution plan indicates that data is spilling into tempdb because of poor estimates.
I have been unable to resolve any of the three ...
1
vote
1
answer
157
views
How can I optimise this SQL GROUP BY to remove duplicates, summing on numeric fields?
I am running the following query:
/*Put the grouped data into a temp table */
DROP TABLE IF EXISTS _TEMP_FORECAST_PARTITION_DATA
SELECT
SCENARIO, PERIOD, DEPARTMENT, ACCOUNT, CATEGORY, CURRENCY,...
-3
votes
2
answers
69
views
When i call this function for 700k record it is very slow
When I call this function for 700k rows it is very slow.
This function calculates the number of holidays between two dates.
ALTER FUNCTION [dbo].[HolyCount]
(
@StartTime datetime,
@...
0
votes
0
answers
56
views
SQL query performance: condition within JOIN ON vs WHERE clause [duplicate]
We have millions of rows in a table. We don't have direct SQL Server access, so I'm unable to see the execution plan. Which query is more optimized in SQL Server?
Condition within JOIN ON clause:
...
2
votes
1
answer
61
views
Why are columns not in my SELECT coming in the output when looking at the execution plan?
I am running the below query and the below index is present to satisfy the query.
SELECT top 100 RCLNT, RBUKRS, RYEAR, RACCT, DRCRK, SUM(ISNULL([000],0.00)) AS CSLVT,SUM(ISNULL([001],0.00)) AS CSL01,...
0
votes
4
answers
85
views
SQL Server not using filtered index for a query
I created this index:
CREATE NONCLUSTERED INDEX [IDX_Speedup_04]
ON [Sessions] ([ServerName] ASC, [SessionId] ASC, [CreatedTime] ASC)
WHERE ([UniqueSessionId] IS NULL)
But the query:
UPDATE [...
1
vote
1
answer
62
views
Performance issues with recursive SQL Server stored procedure for hierarchical data
I have a stored procedure GetCombinedRequestInfosByEmail that retrieves hierarchical data for employees. The procedure performs well for lower-level employees but takes around 55 seconds to execute ...
-1
votes
1
answer
84
views
How can I optimize SQL code when needing to repeatedly call a scalar function for a substantial number of rows?
Here is a table called 'Operations' with a bunch of dates, and I need to find the time differences between six specific dates. But when I try to do this, it takes forever because the table has a lot ...
1
vote
1
answer
138
views
SQL timeout from a simple, one table, query
My query is dead simple but sometimes it gets a timeout exception.
SELECT TOP 100 *
FROM [cmn].[ProductChange]
WHERE shop_id = @shopId
ORDER BY changed_at DESC
This is the execution plan:
If I ...
1
vote
1
answer
76
views
Slow query performance due to partitions
In SQL Server, query B performs hundreds of times faster than query A. There are only 12 partitions in total. How to make query B as simple as query A but keep the performance?
Relevant SQL statements:...
0
votes
1
answer
36
views
Query Optimization and Removal of Sub Queries
I am having performance related issues regarding this query used for a report. The report is going after a view 'dbo.v_auto_no_home' This view has a join on landing_CIM_NIN_DOB. The ...
-1
votes
2
answers
63
views
SQL Query taking too much time in entity framework using ToList() [closed]
I'm utilizing Entity Framework Core. Using this code, fetching 2000 records takes over 1 minute.
Please assist me in finding the data within seconds.
var incomingEmails = acompDbContext.IncomingEmails....
0
votes
1
answer
283
views
How to speed up the performance of multiple update queries in SQL Server
Are there specific strategies or best practices that can be applied to expedite update operations in SQL Server, particularly when dealing with large datasets or complex update conditions?
I have ...
0
votes
1
answer
96
views
Optimizing Query Performance for Large Tables in SQL Server Using Dapper ORM
Introduction:
In our application, we're utilizing the Dapper ORM to interact with a SQL Server database. One of our critical tables, OperationSteps, has grown significantly over time, leading to ...
0
votes
1
answer
89
views
Order by extreme performance impact
I have a complex query in SQL Server which take 70 seconds to complete with 3,000,000 records.
When I remove the two ORDER BY clauses, it just takes 0.5 seconds to complete.
SELECT TOP 100
...