<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Puzzle &#8211; Usage of New Index Hints for Denali &#8211; ForceSeek and ForceScan</title>
	<atom:link href="http://blog.sqlauthority.com/2011/09/23/sql-server-puzzle-usage-of-new-index-hints-for-denali-forceseek-and-forcescan/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2011/09/23/sql-server-puzzle-usage-of-new-index-hints-for-denali-forceseek-and-forcescan/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 17 May 2013 15:26:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: umang</title>
		<link>http://blog.sqlauthority.com/2011/09/23/sql-server-puzzle-usage-of-new-index-hints-for-denali-forceseek-and-forcescan/#comment-448694</link>
		<dc:creator><![CDATA[umang]]></dc:creator>
		<pubDate>Tue, 02 Apr 2013 08:56:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14553#comment-448694</guid>
		<description><![CDATA[SELECT *
FROM Sales.SalesOrderHeader AS h
INNER JOIN Sales.SalesOrderDetail AS d 
    ON h.SalesOrderID = d.SalesOrderID 
WHERE h.TotalDue &gt; 100
AND (d.OrderQty &gt; 5 OR d.LineTotal  100
AND (d.OrderQty &gt; 5 OR d.LineTotal &lt; 1000.00);

Checking execution plan A clustered index seek operation is used to access the data in the Sales.SalesOrderDetail table.]]></description>
		<content:encoded><![CDATA[<p>SELECT *<br />
FROM Sales.SalesOrderHeader AS h<br />
INNER JOIN Sales.SalesOrderDetail AS d<br />
    ON h.SalesOrderID = d.SalesOrderID<br />
WHERE h.TotalDue &gt; 100<br />
AND (d.OrderQty &gt; 5 OR d.LineTotal  100<br />
AND (d.OrderQty &gt; 5 OR d.LineTotal &lt; 1000.00);</p>
<p>Checking execution plan A clustered index seek operation is used to access the data in the Sales.SalesOrderDetail table.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kalyanasundaram.K</title>
		<link>http://blog.sqlauthority.com/2011/09/23/sql-server-puzzle-usage-of-new-index-hints-for-denali-forceseek-and-forcescan/#comment-171328</link>
		<dc:creator><![CDATA[Kalyanasundaram.K]]></dc:creator>
		<pubDate>Sat, 24 Sep 2011 12:43:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14553#comment-171328</guid>
		<description><![CDATA[Hi pinal,

I have not much idea about FORCESEEK &amp; FORCESCAN.
I searched and got the below information:

FORCESEEK: It forces optimizer to use index seek only. Sometimes optimizer does not user proper plan and use index scan which cause high reads on the system. We can use forceseek here to force otpimizer to use index seek which can give better performance.

FORCESCAN: Specifies that the query optimizer use only an index scan operation as the access path to the referenced table or view. The FORCESCAN hint can be useful for queries in which the optimizer underestimates the number of affected rows and chooses a seek operation rather than a scan operation.


-- FORCESEEK and specified index
SELECT ObjectName FROM ObjectItems WITH (FORCESEEK,INDEX (IX_ObjectType_CreateDate)) WHERE ObjectType = &#039;SQL_STORED_PROCEDURE&#039;


-- FORCESCAN and specified index
SELECT  ObjectName FROM ObjectItems WITH (FORCESCAN, INDEX(IX_ObjectId)) WHERE ObjectType = &#039;SQL_STORED_PROCEDURE&#039;]]></description>
		<content:encoded><![CDATA[<p>Hi pinal,</p>
<p>I have not much idea about FORCESEEK &amp; FORCESCAN.<br />
I searched and got the below information:</p>
<p>FORCESEEK: It forces optimizer to use index seek only. Sometimes optimizer does not user proper plan and use index scan which cause high reads on the system. We can use forceseek here to force otpimizer to use index seek which can give better performance.</p>
<p>FORCESCAN: Specifies that the query optimizer use only an index scan operation as the access path to the referenced table or view. The FORCESCAN hint can be useful for queries in which the optimizer underestimates the number of affected rows and chooses a seek operation rather than a scan operation.</p>
<p>&#8211; FORCESEEK and specified index<br />
SELECT ObjectName FROM ObjectItems WITH (FORCESEEK,INDEX (IX_ObjectType_CreateDate)) WHERE ObjectType = &#8216;SQL_STORED_PROCEDURE&#8217;</p>
<p>&#8211; FORCESCAN and specified index<br />
SELECT  ObjectName FROM ObjectItems WITH (FORCESCAN, INDEX(IX_ObjectId)) WHERE ObjectType = &#8216;SQL_STORED_PROCEDURE&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: amit</title>
		<link>http://blog.sqlauthority.com/2011/09/23/sql-server-puzzle-usage-of-new-index-hints-for-denali-forceseek-and-forcescan/#comment-171258</link>
		<dc:creator><![CDATA[amit]]></dc:creator>
		<pubDate>Sat, 24 Sep 2011 09:03:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14553#comment-171258</guid>
		<description><![CDATA[hello sir,
i have created a website in asp.net with mssql. and there is a .cs file is generated automatic in temp file in local system,when we are going to upload this website ,this website is not getting that path?is there any idea to generate this file into our web folder]]></description>
		<content:encoded><![CDATA[<p>hello sir,<br />
i have created a website in asp.net with mssql. and there is a .cs file is generated automatic in temp file in local system,when we are going to upload this website ,this website is not getting that path?is there any idea to generate this file into our web folder</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2011/09/23/sql-server-puzzle-usage-of-new-index-hints-for-denali-forceseek-and-forcescan/#comment-170926</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Fri, 23 Sep 2011 14:57:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14553#comment-170926</guid>
		<description><![CDATA[Hi All,

The contest is not about how to use FORCESCAN or FORCESEEK. It is about writing a normal query and then using this hint and proving that it improves the performance.

See if you can come up with that kind of example...]]></description>
		<content:encoded><![CDATA[<p>Hi All,</p>
<p>The contest is not about how to use FORCESCAN or FORCESEEK. It is about writing a normal query and then using this hint and proving that it improves the performance.</p>
<p>See if you can come up with that kind of example&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sudhir Rawat</title>
		<link>http://blog.sqlauthority.com/2011/09/23/sql-server-puzzle-usage-of-new-index-hints-for-denali-forceseek-and-forcescan/#comment-170923</link>
		<dc:creator><![CDATA[Sudhir Rawat]]></dc:creator>
		<pubDate>Fri, 23 Sep 2011 14:40:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14553#comment-170923</guid>
		<description><![CDATA[ForceScan
++++++++++++
Select Emp.Name, Emp.Address, EmpPay.Salary
From EmplyeeMaster Emp
INNER JOIN EmployeePay EmpPay
WITH (FORCESCAN)
ON  Emp.[ID] = EmpPay.[ID]
Where Emp.[Salary] &gt; 100000

ForceSeek
+++++++++++
Select Emp.Name, Emp.Address, EmpPay.Salary
From EmplyeeMaster Emp
INNER JOIN EmployeePay EmpPay
WITH (FORCESEEK)
ON  Emp.[ID] = EmpPay.[ID]
Where Emp.[Salary] &gt; 100000]]></description>
		<content:encoded><![CDATA[<p>ForceScan<br />
++++++++++++<br />
Select Emp.Name, Emp.Address, EmpPay.Salary<br />
From EmplyeeMaster Emp<br />
INNER JOIN EmployeePay EmpPay<br />
WITH (FORCESCAN)<br />
ON  Emp.[ID] = EmpPay.[ID]<br />
Where Emp.[Salary] &gt; 100000</p>
<p>ForceSeek<br />
+++++++++++<br />
Select Emp.Name, Emp.Address, EmpPay.Salary<br />
From EmplyeeMaster Emp<br />
INNER JOIN EmployeePay EmpPay<br />
WITH (FORCESEEK)<br />
ON  Emp.[ID] = EmpPay.[ID]<br />
Where Emp.[Salary] &gt; 100000</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Partha Pratim Dinda</title>
		<link>http://blog.sqlauthority.com/2011/09/23/sql-server-puzzle-usage-of-new-index-hints-for-denali-forceseek-and-forcescan/#comment-170819</link>
		<dc:creator><![CDATA[Partha Pratim Dinda]]></dc:creator>
		<pubDate>Fri, 23 Sep 2011 04:52:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14553#comment-170819</guid>
		<description><![CDATA[1.
FORSCAN

SELECT  ObjName FROM Objitems
 WITH (FORCESCAN) WHERE ObjectType = &#039;SQL_STORED_PROCEDURE&#039;

FORSCAN and specified index

SELECT  ObjName FROM ObjItems 
WITH (FORCESCAN, INDEX(IX_ObjectId)) 
WHERE ObjectType = &#039;SQL_STORED_PROCEDURE&#039;

2.
FORCESEEK

SELECT  ObjName FROM ObjItems
 WITH (FORCESEEK) WHERE ObjectType = &#039;SQL_STORED_PROCEDURE&#039;


FORCESEEK and specified index

SELECT ObjName FROM ObjItems 
WITH (FORCESEEK,INDEX (IX_ObjectType_CreateDate)) WHERE ObjectType = &#039;SQL_STORED_PROCEDURE&#039;

 FORCESEEK and specified index using at least the specified index columns

SELECT ObjName FROM ObjItems
 WITH (FORCESEEK(IX_ObjectType_CreateDate(ObjectType,CreateDate))) WHERE ObjectType = &#039;SQL_STORED_PROCEDURE&#039;]]></description>
		<content:encoded><![CDATA[<p>1.<br />
FORSCAN</p>
<p>SELECT  ObjName FROM Objitems<br />
 WITH (FORCESCAN) WHERE ObjectType = &#8216;SQL_STORED_PROCEDURE&#8217;</p>
<p>FORSCAN and specified index</p>
<p>SELECT  ObjName FROM ObjItems<br />
WITH (FORCESCAN, INDEX(IX_ObjectId))<br />
WHERE ObjectType = &#8216;SQL_STORED_PROCEDURE&#8217;</p>
<p>2.<br />
FORCESEEK</p>
<p>SELECT  ObjName FROM ObjItems<br />
 WITH (FORCESEEK) WHERE ObjectType = &#8216;SQL_STORED_PROCEDURE&#8217;</p>
<p>FORCESEEK and specified index</p>
<p>SELECT ObjName FROM ObjItems<br />
WITH (FORCESEEK,INDEX (IX_ObjectType_CreateDate)) WHERE ObjectType = &#8216;SQL_STORED_PROCEDURE&#8217;</p>
<p> FORCESEEK and specified index using at least the specified index columns</p>
<p>SELECT ObjName FROM ObjItems<br />
 WITH (FORCESEEK(IX_ObjectType_CreateDate(ObjectType,CreateDate))) WHERE ObjectType = &#8216;SQL_STORED_PROCEDURE&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhishek Mishra</title>
		<link>http://blog.sqlauthority.com/2011/09/23/sql-server-puzzle-usage-of-new-index-hints-for-denali-forceseek-and-forcescan/#comment-170800</link>
		<dc:creator><![CDATA[Abhishek Mishra]]></dc:creator>
		<pubDate>Fri, 23 Sep 2011 02:57:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14553#comment-170800</guid>
		<description><![CDATA[1)SELECT  ObjectName FROM ObjectItems WITH (FORCESEEK)
WHERE ObjectType = &#039;SQL_STORED_PROCEDURE&#039; 
2)SELECT  ObjectName FROM ObjectItems WITH (FORCESCAN)
WHERE ObjectType = &#039;SQL_STORED_PROCEDURE&#039;]]></description>
		<content:encoded><![CDATA[<p>1)SELECT  ObjectName FROM ObjectItems WITH (FORCESEEK)<br />
WHERE ObjectType = &#8216;SQL_STORED_PROCEDURE&#8217;<br />
2)SELECT  ObjectName FROM ObjectItems WITH (FORCESCAN)<br />
WHERE ObjectType = &#8216;SQL_STORED_PROCEDURE&#8217;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
