Skip to main content

All Questions

5 votes
1 answer
104 views

Analyising Implict CAST

I have an academic scenario, which I would like to know how to analyse. DECLARE @date DATETIME SET @date = getDate() SET @date = DATEADD(DAY, DATEDIFF(DAY, 0, @date-3), 3) This will round ...
MatBailie's user avatar
  • 85.8k
2 votes
2 answers
98 views

Question on Query execution

In the below query if the Patients table has 1000 records how many times TableValueFunction executes? Only once or 1000 time? This is a query in a Stored Procedure, do you have a better idea to ...
CharithJ's user avatar
  • 47k
3 votes
5 answers
211 views

SQL select field causing major performance problem

I have a stored procedure that joins in numerous tables and selects fields from them. One of the tables being a temporary table. SELECT a.Field1, a.Field2, b.Field3, b.Field4, c....
Dustin Laine's user avatar
  • 38.4k
1 vote
2 answers
4k views

Getting query / execution plan for dynamic sql in SQL Server [duplicate]

Possible Duplicate: How do I obtain a Query Execution Plan? how can I see the execution plan in SQL Server 2005 for a dynamic sql that is executed? I cannot save any files on the computer where ...
KOT's user avatar
  • 2,046
9 votes
3 answers
8k views

SQL Server sp_ExecuteSQL and Execution Plans

I have a query which is super fast in SQL Server Management Studio and super slow when run under sp_ExecuteSQL. Is this to do with caching of execution plans not happening when run under sp_ExecuteSQL?...
AJM's user avatar
  • 32.4k
2 votes
1 answer
69 views

Adding inner query is not changing the execution plan

Consider the following queries. select * from contact where firstname like '%some%' select * from (select * from contact) as t1 where firstname like '%some%' The execution plans for both ...
Navaneeth K N's user avatar
1 vote
2 answers
461 views

Different execution plan for similar queries

I am running two very similar update queries but for a reason unknown to me they are using completely different execution plans. Normally this wouldn't be a problem but they are both updating exactly ...
Graham Clements's user avatar
2 votes
2 answers
2k views

No query plan for procedure in SQL Server 2005

We have a SQL Server DB with 150-200 stored procs, all of which produce a viewable query plan in sys.dm_exec_query_plan except for one. According to http://msdn.microsoft.com/en-us/library/ms189747....
sidereal's user avatar
  • 1,110
3 votes
4 answers
631 views

Caching SQL execution plans

I know SQL server 2005 does some amount of execution plan caching, but would that be enough to create a difference of hours between the same query being run twice? The first time it takes 3 hours the ...
Bmw's user avatar
  • 407
2 votes
4 answers
1k views

Does the sequence in which we use join in a query effects its execution time?

Does the sequence in which we use join in a query effects its execution time ?
HotTester's user avatar
  • 5,730
6 votes
4 answers
4k views

Question on how to read a SQL Execution plan

I have executed a query and included the Actual Execution Plan. There is one Hash Match that is of interest to me because it's subtree uses a Index Scan instead of an index seek. When I mouse over ...
Abe Miessler's user avatar
  • 84.3k
0 votes
4 answers
236 views

Is my execution plan trying to trick me?

I am trying to speed up a long running query that I have (takes about 10 minutes to run...). In order to track down what part of the query is costing me the most time I included the Actual Execution ...
Abe Miessler's user avatar
  • 84.3k
1 vote
3 answers
1k views

T-SQL Process Design and Execution Plan (UDF Parameter Sniffing?)

On SQL Server 2005, I have a complex multi-level allocation process which looks like this (pseudo-SQL): FOR EACH @LVL_NUM < @MAX_LVL: INSERT INTO ALLOCS SELECT 'OUT', * FROM BALANCES(@LVL_NUM) ...
Cade Roux's user avatar
  • 89.2k
55 votes
6 answers
139k views

Measuring Query Performance : "Execution Plan Query Cost" vs "Time Taken"

I'm trying to determine the relative performance of two different queries and have two ways of measuring this available to me: 1. Run both and time each query 2. Run both and get "Query Cost" from the ...
MatBailie's user avatar
  • 85.8k
4 votes
6 answers
6k views

Different Execution Plan for the same Stored Procedure

We have a query that is taking around 5 sec on our production system, but on our mirror system (as identical as possible to production) and dev systems it takes under 1 second. We have checked out ...
Robert Wagner's user avatar

15 30 50 per page