Skip to main content

All Questions

0 votes
2 answers
1k views

Query Plan Recompiled suddenly and degrades performance

Scenario: We have a simple select query Declare P@ SELECT TOP(1) USERID FROM table WHERE non_clusteredindex_column = (@P) ORDER BY PK_column DESC It usually executes with in 0.12sec since 1 year. ...
Damodara Lanka's user avatar
2 votes
1 answer
902 views

Clustered index update, how changing the index only at different column value?

I've table, example as Id int primary key(clustered index) Name varchar(255)not null (non-clustered index) .. .. Other columns I execute stored procedur as update table1 set table1.Name=isnull(@...
KreminT's user avatar
  • 179
3 votes
1 answer
2k views

Table Valued Parameters with Estimated Number of Rows 1

I have been searching the internet for hours trying to figure out how to improve the performance of my query using table-valued parameters (TVP). After hours of searching, I finally determined what ...
Chris Tremblay's user avatar
0 votes
1 answer
526 views

SQL Server choice wrong execution plan

When this query is executed, SQL Server chooses a wrong execution plan, why? SELECT top 10 AccountNumber , AVERAGE FROM [M].[dbo].[Account] WHERE [Code] = 9201 Go SELECT top 10 ...
user3189030's user avatar
-1 votes
1 answer
5k views

Query Stuck in Suspended mode with IO_Completition as Wait Type

I am running a query in SQL Server 2008r2, it is stuck with Task State: Suspended (Sometimes changes to Running but mostly Suspended) Wait Type: IO_Completion. There is another query running on ...
daniely's user avatar
  • 7,633
3 votes
3 answers
3k views

How can i avoid an extra inner join to optimize this query?

Is there any way where I can avoid the inner join to get the customer firstname, and lastname from customer table and how can i optimize the execution plan? SELECT c1.firstname, c1.lastname, t.* FROM ...
Registered User's user avatar
4 votes
2 answers
8k views

The Same SQL Query takes longer to run in one DB than another DB under the same server

I have a SQL database server and 2 databases under it with the same structure and data. I run the same sql query in the 2 databases, one of them takes longer while the other completes in less than 50% ...
Divya's user avatar
  • 41
1 vote
2 answers
3k views

SQL Server : delay before output (a print statement) is produced

I may have a slight feeling as to what is going on, but I thought I'd ask to get confirmation, and potentially look at an alternative. As a slight background, I've written a C# application that is ...
Chris's user avatar
  • 8,466
2 votes
3 answers
865 views

Select columns affect execution plan?

I have a query something like this. It has an execution plan using an index that I expect, up until the amount of data (i.e. the number of characters) returned by the SELECT goes over a boundary. At ...
rar's user avatar
  • 21
2 votes
2 answers
1k views

SQL Server 2008: execution plan depends on date parameters

I have a SQL query whose execution plan depends on the DateTime parameters that I provide. I understand that if I have a condition like: WHERE Date > '2012-02-28' AND Date < '2012-01-01' then ...
Ioana Marcu's user avatar
1 vote
2 answers
2k views

Resetting Execution Plans

I am optimizing a query and am worried that SQL Server is caching execution plans so want to wipe them. How do I do this?
AJM's user avatar
  • 32.4k
5 votes
3 answers
12k views

Simple SQL to check if parent has any child rows or not

I show a grid with parent data and need to show icon if it has a relevant child row(s) exist. My DB is in SQL Server 2008. Let me simplify, I've the following two tables - Order (PK : ID) ...
Hemant Tank's user avatar
  • 1,734
2 votes
2 answers
4k views

SQL: actual number of rows difference [duplicate]

Possible Duplicate: How does SQL server work out the estimated number of rows? I was just looking through SQL Server Graphical Execution plan and I encountered the following two information: ...
Rocky Singh's user avatar
  • 15.3k
1 vote
1 answer
684 views

Query to result execution plan in SQL Server 2008 out of SSMS

Hi friends is there a query something like select * from [stored proc] which returns execution plan of SQL statement in XML format...I don't want to use SSMS .
sqlnewbie's user avatar
  • 867
2 votes
1 answer
281 views

SQL Server 2008: Execution plan contains wrong data?

Consider the following situation: There is an xml that contains data @XmlData The @XmlData is extracted into a relational table (@ItemList) A table variable is defined (@Table) The data extracted ...
Timofey's user avatar
  • 2,498

15 30 50 per page