Skip to main content

All Questions

1 vote
1 answer
2k views

Is there any difference between UNIQUE NONCLUSTERED INDEX and NONCLUSTERED INDEX?

I am using SQL Server 2008 R2 and this index in my database was already created: CREATE UNIQUE NONCLUSTERED INDEX IndexT1 ON T1 ( [ID] ASC, [logID] ASC ) INCLUDE ([MasterID]) WHERE ([logID] ...
Ardalan Shahgholi's user avatar
2 votes
1 answer
231 views

Get an actual plan for a stored function

I want to get an execution plan for my scalar function because it differs from one when I'm only running a function body. I was in same situation some time ago, and I solved it by defragmenting ...
Alex Zhukovskiy's user avatar
0 votes
0 answers
139 views

TSQL IN Operator over EXISTS, is there a difference?

Following two queries produce exactly the same execution plan on SQL Server 2008 R2. But I feel like the second query should perform better. Why do I see the same query execution plan for these two? ...
BuddhiP's user avatar
  • 6,401
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
5 votes
1 answer
7k views

Find out the slow running stored procedure [duplicate]

Possible Duplicate: How to find slowest queries In Sql Server 2008, is there any option to find out which stored procedure running slowly among all (When the no. of stored procedures is very ...
gee'K'iran's user avatar
2 votes
1 answer
280 views

Wrong Plan for CONTAINS condition in the MS SQL

Sql server 2008 R2 I have two queries DECLARE @title NVARCHAR(500) = '"Finite" AND "Elements"' select * from papers p where (@title = '""' OR CONTAINS(p.name, @title)) select * from papers p where ...
Александр ��ахин's user avatar
6 votes
4 answers
1k views

Change in query plan and execution time with TOP and ESCAPE

One of the query (given below) is taking 90+ seconds to execute. It returns ~500 rows from a rather large table LogMessage. If ESCAPE N'~' is removed from the query it executes within few seconds. ...
amit_g's user avatar
  • 31.2k