 




<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IT Answers &#187; SQL Server query optimization</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/tag/sql-server-query-optimization/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers</link>
	<description></description>
	<lastBuildDate>Wed, 22 May 2013 14:27:36 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>What are the query optimization techniques used in SQL 2000?</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-18/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/sql-18/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 17:22:49 +0000</pubDate>
		<dc:creator>Gomsbk</dc:creator>
				<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server 2000 queries]]></category>
		<category><![CDATA[SQL Server Query]]></category>
		<category><![CDATA[SQL Server query optimization]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[What are the query optimization techniques used in SQL?]]></description>
				<content:encoded><![CDATA[<p>What are the query optimization techniques used in SQL?</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/sql-18/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Does SQL support nonlinear recursive queries?</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-17/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/sql-17/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 10:15:12 +0000</pubDate>
		<dc:creator>Gomsbk</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Query]]></category>
		<category><![CDATA[SQL Server query optimization]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[does sql supports nonlinear recursive queries]]></description>
				<content:encoded><![CDATA[<p>does sql supports nonlinear recursive queries</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/sql-17/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spatial query optimizing</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/spatial-query-optimizing/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/spatial-query-optimizing/#comments</comments>
		<pubDate>Sat, 29 May 2010 23:32:53 +0000</pubDate>
		<dc:creator>Overtech</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Express]]></category>
		<category><![CDATA[SQL Server query optimization]]></category>
		<category><![CDATA[SQL Server Spatial Data]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I have a development machine and a production machine with identical databases, but I&#8217;m getting huge differences in execution plans when running a spatial query. First, my development machine: It&#8217;s SQL Server Express x64 with Reporting Services running on Win7 with 8Gb RAM. Then my production machine: SQL Server with Reporting Services running on Windows [...]]]></description>
				<content:encoded><![CDATA[<p>I have a development machine and a production machine with identical databases, but I&#8217;m getting huge differences in execution plans when running a spatial query.</p>
<p>First, my development machine:<br />
It&#8217;s SQL Server Express x64 with Reporting Services running on Win7 with 8Gb RAM.</p>
<p>Then my production machine:<br />
SQL Server with Reporting Services running on Windows Server 2008 with 8Gb RAM (x86 though, so only 4Gb usable).</p>
<p>I have a table that contains about 3000+ records containing polygon coordinates.  The database that holds the table is identical on both machines.  A sample query I&#8217;m running on the dev machine executes in a fraction of a second but takes 11 seconds on the production machine.  When I looked at the execution plans, I was surprised to see that they are completely different on the two machines.</p>
<p>The query is:</p>
<pre>
SELECT *
FROM USCounties
WHERE geography::STGeomFromText('POINT(-86.7535 33.6499)', 4326).STIntersects(Polygon) = 1
</pre>
<p>On the production machine the execution plan shows 3 steps:<br />
SELECT Cost: 0%<br />
Filter Cost: 97%<br />
Clustered Index Scan Cost: 3%</p>
<p>But on the dev machine the execution plan is much more complex and includes things like &#8220;Nested Loops&#8221;, &#8220;Hash Match&#8221; and &#8220;Compute Scalar&#8221;.  The indexes on the two machines look identical from what I can see and the data is identical.  I would expect a performance difference just based on x86 vs x64, but I don&#8217;t understand the difference in execution plans&#8230;</p>
<p>I really don&#8217;t know much of anything about db optimization, any tips from the experts here?</p>
<p> - Dave</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/spatial-query-optimizing/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Substring Query SQL</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/substring-query/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/substring-query/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 00:44:13 +0000</pubDate>
		<dc:creator>Smillsie</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server query optimization]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Hi All, I&#8217;m trying to build a query to join names in one table to abbreviated names in another table. So for example I have &#8211; Harry Harold Harrison on one table, but in the other table I have just Har, this can vary in length so does anyone know how I can sum the [...]]]></description>
				<content:encoded><![CDATA[<p>Hi All, I&#8217;m trying to build a query to join names in one table to abbreviated names in another table. So for example I have &#8211; Harry Harold Harrison on one table, but in the other table I have just Har, this can vary in length so does anyone know how I can sum the amount of Har names with the total from the other table bearing in mind the data could be Fred for frederick, freddy etc, Kind Regards, Stuart Mills</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/substring-query/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Optimize the query in sql server</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/optimize-the-query-in-sql-server/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/optimize-the-query-in-sql-server/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 12:35:21 +0000</pubDate>
		<dc:creator>Rajupatil</dc:creator>
				<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server Query]]></category>
		<category><![CDATA[SQL Server query optimization]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[CREATE VIEW [dbo].[vwResults] AS SELECT r.ResultsPK, b.PersonID, dbo.ltcPerson.FirstName, dbo.ltcPerson.LastName, dbo.ltcPerson.PersonFriendlyID, b.DateCreated, b.FormName, r.FieldName, r.ValueString, r.ValueNumber, r.ValueDate, r.ValueTextInt, r.ValueBit, b.UserID, b.BatchID, b.ParentID, r.Active, CASE WHEN b.ParentID = 0 THEN 0 ELSE 1 END AS IsChildRecord, CAST(b.PersonID AS varchar(4)) AS PersonIDStr FROM dbo.ltcBatch b INNER JOIN dbo.ltcResults r ON b.BatchID = r.BatchID INNER JOIN dbo.ltcPerson ON b.PersonID [...]]]></description>
				<content:encoded><![CDATA[<p>CREATE VIEW [dbo].[vwResults]<br />
AS<br />
SELECT     r.ResultsPK, b.PersonID, dbo.ltcPerson.FirstName, dbo.ltcPerson.LastName, dbo.ltcPerson.PersonFriendlyID, b.DateCreated, b.FormName,<br />
                      r.FieldName, r.ValueString, r.ValueNumber, r.ValueDate, r.ValueTextInt, r.ValueBit, b.UserID, b.BatchID, b.ParentID, r.Active,<br />
                      CASE WHEN b.ParentID = 0 THEN 0 ELSE 1 END AS IsChildRecord, CAST(b.PersonID AS varchar(4)) AS PersonIDStr<br />
FROM         dbo.ltcBatch b INNER JOIN<br />
                      dbo.ltcResults r ON b.BatchID = r.BatchID INNER JOIN<br />
                      dbo.ltcPerson ON b.PersonID = dbo.ltcPerson.PersonID<br />
GO</p>
<p>the ltcResults table have more than 30 million records.</p>
<p>CREATE VIEW [dbo].[vwRptHeaderToResultsFormRpts]<br />
AS<br />
SELECT     TOP 100 PERCENT dbo.vwResults.ParentID, dbo.vwResults.BatchID, dbo.vwResults.PersonID, dbo.vwResults.FormName, dbo.vwResults.FieldName,<br />
                      dbo.vwResults.ValueString, dbo.vwResults.ValueNumber, dbo.vwResults.ValueDate, dbo.vwResults.ValueBit, dbo.vwResults.Active,<br />
                      dbo.vwRptFields.ControlGroupType, dbo.vwRptFields.ControlCaption, dbo.vwRptFields.ReportCaption AS ReportCaptionField,<br />
                      dbo.vwRptFields.ControlName, dbo.vwRptFields.ControlSeqNo, dbo.vwRptFields.itemtype, dbo.vwResults.FirstName, dbo.vwResults.LastName,<br />
                      dbo.vwResults.PersonFriendlyID, dbo.vwResults.DateCreated, dbo.vwResults.IsChildRecord, dbo.vwRptFields.FormCaption,<br />
                      dbo.vwRptFields.FormSeqNo, dbo.vwRptFields.TabCaption, dbo.vwRptFields.TabSeqNo, dbo.vwRptFields.PanelCaption, dbo.vwRptFields.PanelSeqNo,<br />
                      dbo.vwResults.ResultsPK, dbo.vwResults.UserID, dbo.vwRptHeader.CrystalRptID, dbo.vwRptHeader.ReportCaption<br />
FROM         dbo.vwRptFields INNER JOIN<br />
                      dbo.vwRptHeader ON dbo.vwRptFields.FormName = dbo.vwRptHeader.RptFormName INNER JOIN<br />
                      dbo.vwResults ON dbo.vwRptFields.fieldname = dbo.vwResults.FieldName<br />
ORDER BY dbo.vwRptFields.FormSeqNo, dbo.vwRptFields.TabSeqNo, dbo.vwRptFields.PanelSeqNo, dbo.vwRptFields.ControlSeqNo<br />
GO</p>
<p>other views are not taking more time but vwResults</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/optimize-the-query-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Performance issues with a large table in SQL Server 2005</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/performance-issues-with-a-large-table-in-sql-server-2005/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/performance-issues-with-a-large-table-in-sql-server-2005/#comments</comments>
		<pubDate>Sun, 17 May 2009 00:11:01 +0000</pubDate>
		<dc:creator>Thecoolestguy</dc:creator>
				<category><![CDATA[SQL Server 2005 performance]]></category>
		<category><![CDATA[SQL server 2005 performance tuning]]></category>
		<category><![CDATA[SQL Server query optimization]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I have an application that is managing inventory for a company that has multiple locations. Items are being inserted into an inventory table roughly every 5-6 seconds from three locations. At the same time, this company is packing inventory in boxes in order to fulfill orders. I have a table setup for this in which [...]]]></description>
				<content:encoded><![CDATA[<p>I have an application that is managing inventory for a company that has multiple locations. Items are being inserted into an inventory table roughly every 5-6 seconds from three locations. </p>
<p>At the same time, this company is packing inventory in boxes in order to fulfill orders. I have a table setup for this in which inserts are made for an inventory id and a box id (tied to a purchase order table) to show when an item has been packed and is no longer in inventory. Roughly 6000 items are being added per day into inventory as well as being shipped out of inventory. </p>
<p>Before an item is being shipped &#8211; I have to first check the inventory table to make sure the item exists in inventory and also need to check the shipping table to make sure the item hasn&#8217;t been shipped. I&#8217;m also checking these tables on the sales side to verify when an order has been completed. These two tables are being hit every few seconds both with reads and writes.</p>
<p>I&#8217;m running into some performance issues as the size of my table is growing. I&#8217;ve been researching the problem and have a couple of ideas on how to fix this &#8211; but wanted to check here first to see if I&#8217;m on the right track.</p>
<p>1. Indexing this table in order to get better performance during the lookups. From what I&#8217;ve read, this will improve the select queries &#8211; but will slow down the inserts since the table will be re-indexed after each insert. Since I&#8217;m inserting into these tables every couple of seconds &#8211; I&#8217;m wondering if having indexes on these tables might degrade performance instead of improving it.  </p>
<p>2. The queries are being performed via my application. Ie, a query checks to make sure the item is active in inventory &#8211; results are returned to the application and either an error is thrown or an insert statement is re-submitted to the SQL server. By moving this into a stored procedure &#8211; I&#8217;ll remove the network traffic associated with going back and forth between the application server and the sql server.</p>
<p>3. I&#8217;ve read a little about partioning and it sounds like this might help (ie, partioning on each of the location id&#8217;s) &#8211; but I have not gone into it enough to really know enough about it. </p>
<p>Hopefully my question was clear. Any advice or suggestions are appreciated.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/performance-issues-with-a-large-table-in-sql-server-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Execute a view/query is slower in SQL Server 2005 than 2000</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/execute-a-viewquery-is-slower-in-2005-than-2000/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/execute-a-viewquery-is-slower-in-2005-than-2000/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 09:15:54 +0000</pubDate>
		<dc:creator>Db23</dc:creator>
				<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server Query]]></category>
		<category><![CDATA[SQL Server query optimization]]></category>
		<category><![CDATA[VARCHAR]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Hi, I have migrated a database from 2000 to 2005, updated the statistic and rebuild the index. When I run the following query &#8220;select top 500 * from myview order by name&#8221;, it is extremely slower in 2005 than 2000. The myview simply does an inner join with 2 table. The name is varchar(50). Strangely [...]]]></description>
				<content:encoded><![CDATA[<p>Hi,</p>
<p>I have migrated a database from 2000 to 2005, updated the statistic and rebuild the index. </p>
<p>When I run the following query<br />
&#8220;select top 500 * from myview order by name&#8221;, it is extremely slower in 2005 than 2000. The myview simply does an inner join with 2 table. The name is varchar(50). Strangely when I remove the top 500, the time to run the query on 2000 and 2005 quite similar. </p>
<p>Does anyone have any idea why this is occurring, or any input, this is really puzzling me???</p>
<p>Thanks</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/execute-a-viewquery-is-slower-in-2005-than-2000/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SQL Server security bulletin MS09-004</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-security-bulletin-ms09-004/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-security-bulletin-ms09-004/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 17:32:04 +0000</pubDate>
		<dc:creator>Rik</dc:creator>
				<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server query optimization]]></category>
		<category><![CDATA[SQL Server security]]></category>
		<category><![CDATA[SQL Server security bulletin MS09-004]]></category>
		<category><![CDATA[SQL Server Security Bulletins]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Has anyone dealt with issues related to this security bulletin ?]]></description>
				<content:encoded><![CDATA[<p>Has anyone dealt with issues related to this security bulletin ?</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-security-bulletin-ms09-004/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/24 queries in 0.033 seconds using memcached
Object Caching 783/856 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-22 20:22:02 -->