<?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; Rules for Optimizining Any Query &#8211; Best Practices for Query Optimization</title>
	<atom:link href="http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Mon, 13 Feb 2012 15:11:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: swati lodha</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-198548</link>
		<dc:creator><![CDATA[swati lodha]]></dc:creator>
		<pubDate>Fri, 18 Nov 2011 12:54:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-198548</guid>
		<description><![CDATA[Hello  sir,

\very Nice Blog of u.Thanks for putting such helpful information on your blog. It always helped me to find solutions for queries.]]></description>
		<content:encoded><![CDATA[<p>Hello  sir,</p>
<p>\very Nice Blog of u.Thanks for putting such helpful information on your blog. It always helped me to find solutions for queries.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sandeep B</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-181136</link>
		<dc:creator><![CDATA[Sandeep B]]></dc:creator>
		<pubDate>Thu, 20 Oct 2011 10:13:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-181136</guid>
		<description><![CDATA[Hi Pinal,

Thanks for putting such helpful information on your blog. It always helped me to find solutions for queries. Thanks again.

Sandeep B]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Thanks for putting such helpful information on your blog. It always helped me to find solutions for queries. Thanks again.</p>
<p>Sandeep B</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vijaya kumar</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-165591</link>
		<dc:creator><![CDATA[vijaya kumar]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 08:31:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-165591</guid>
		<description><![CDATA[Hello,
    How to write a syntax for T-SQL,user defined functions and stored block procedure.]]></description>
		<content:encoded><![CDATA[<p>Hello,<br />
    How to write a syntax for T-SQL,user defined functions and stored block procedure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harsh</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-67744</link>
		<dc:creator><![CDATA[Harsh]]></dc:creator>
		<pubDate>Thu, 29 Apr 2010 13:14:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-67744</guid>
		<description><![CDATA[Surersh,
Create a text file of the table and use it as a source instead of directly using the table as the source.
You can use the cmd utility called bcp.exe to create the text file. Please reply as to how it works out.]]></description>
		<content:encoded><![CDATA[<p>Surersh,<br />
Create a text file of the table and use it as a source instead of directly using the table as the source.<br />
You can use the cmd utility called bcp.exe to create the text file. Please reply as to how it works out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Suresh</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-62957</link>
		<dc:creator><![CDATA[Suresh]]></dc:creator>
		<pubDate>Mon, 15 Mar 2010 11:25:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-62957</guid>
		<description><![CDATA[Hi

 I am suresh. Thjs is my question.

I am inserting 8 lacks records from source table to multiple destination table with some ETL operation. First 10000 records getting inserted in 10 minutes and after that it takes 20 minutes to insert 2000 records it keeps on increasing the time. what would be the solution. plz asap]]></description>
		<content:encoded><![CDATA[<p>Hi</p>
<p> I am suresh. Thjs is my question.</p>
<p>I am inserting 8 lacks records from source table to multiple destination table with some ETL operation. First 10000 records getting inserted in 10 minutes and after that it takes 20 minutes to insert 2000 records it keeps on increasing the time. what would be the solution. plz asap</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilesh</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-57697</link>
		<dc:creator><![CDATA[Nilesh]]></dc:creator>
		<pubDate>Wed, 18 Nov 2009 12:55:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-57697</guid>
		<description><![CDATA[Pinal,

Many time I am reading your blogs.
In this article you have mentioend very very basic optimization technique.

I would request you to separate your articale for expert, beginners etc.

-Nilesh]]></description>
		<content:encoded><![CDATA[<p>Pinal,</p>
<p>Many time I am reading your blogs.<br />
In this article you have mentioend very very basic optimization technique.</p>
<p>I would request you to separate your articale for expert, beginners etc.</p>
<p>-Nilesh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hidha</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-56109</link>
		<dc:creator><![CDATA[Hidha]]></dc:creator>
		<pubDate>Thu, 24 Sep 2009 05:17:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-56109</guid>
		<description><![CDATA[Thanks for the Tips. It was useful.]]></description>
		<content:encoded><![CDATA[<p>Thanks for the Tips. It was useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shubhangi</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-55903</link>
		<dc:creator><![CDATA[Shubhangi]]></dc:creator>
		<pubDate>Wed, 16 Sep 2009 05:10:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-55903</guid>
		<description><![CDATA[Hello Pinal,

I wanted I wanted to know which kind of queries can be moved to stored procedures. Can you please guide me on Ad- Hoc, dynamic and parametrized queries in reference to SP. What will be beneficial for performance improvement?]]></description>
		<content:encoded><![CDATA[<p>Hello Pinal,</p>
<p>I wanted I wanted to know which kind of queries can be moved to stored procedures. Can you please guide me on Ad- Hoc, dynamic and parametrized queries in reference to SP. What will be beneficial for performance improvement?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narenndra</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-54009</link>
		<dc:creator><![CDATA[Narenndra]]></dc:creator>
		<pubDate>Thu, 23 Jul 2009 12:05:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-54009</guid>
		<description><![CDATA[Hi  Hoapino and all,

Will d views occupy place in the Database?N can some one help me the meaning of MOVE D LOGIC OF UDF TO SP

Thanks,
Narenndra]]></description>
		<content:encoded><![CDATA[<p>Hi  Hoapino and all,</p>
<p>Will d views occupy place in the Database?N can some one help me the meaning of MOVE D LOGIC OF UDF TO SP</p>
<p>Thanks,<br />
Narenndra</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jayant das</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-53374</link>
		<dc:creator><![CDATA[jayant das]]></dc:creator>
		<pubDate>Wed, 01 Jul 2009 12:12:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-53374</guid>
		<description><![CDATA[Hi Pinal Dave

This is very usefull to my daily work as dba thanks alot

Jayant]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal Dave</p>
<p>This is very usefull to my daily work as dba thanks alot</p>
<p>Jayant</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Net Wolf (Hoapino)</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-52655</link>
		<dc:creator><![CDATA[Net Wolf (Hoapino)]]></dc:creator>
		<pubDate>Tue, 02 Jun 2009 14:47:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-52655</guid>
		<description><![CDATA[In simple terms views like any other sql statements need to be compiled then executed which comsumes time and space for large amount of data unlike stored procs which are already precompiled]]></description>
		<content:encoded><![CDATA[<p>In simple terms views like any other sql statements need to be compiled then executed which comsumes time and space for large amount of data unlike stored procs which are already precompiled</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Net Wolf (Hoapino)</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-52653</link>
		<dc:creator><![CDATA[Net Wolf (Hoapino)]]></dc:creator>
		<pubDate>Tue, 02 Jun 2009 14:14:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-52653</guid>
		<description><![CDATA[Hi Sourabh
If you look closely at Dave&#039;s article, you&#039;ll want to change the article to &quot;Tips for db optimization&quot;. This is because he touched on table maintanance, views Vs stored procs, triggers and we use queries in all the above processes but tables.

Now to attend to your question, views act like replicated table combination and are updated instantly as the tables get data, so in the testing enviroment they appear to behave due to small amount of data and reduced concurrency on data access thats why Michale says he has seen people suffering. In addition it is even a hastle to troubleshoot mishaps. All in all, try to check views vs stored procedures.

As for you Dave, keep up the good work]]></description>
		<content:encoded><![CDATA[<p>Hi Sourabh<br />
If you look closely at Dave&#8217;s article, you&#8217;ll want to change the article to &#8220;Tips for db optimization&#8221;. This is because he touched on table maintanance, views Vs stored procs, triggers and we use queries in all the above processes but tables.</p>
<p>Now to attend to your question, views act like replicated table combination and are updated instantly as the tables get data, so in the testing enviroment they appear to behave due to small amount of data and reduced concurrency on data access thats why Michale says he has seen people suffering. In addition it is even a hastle to troubleshoot mishaps. All in all, try to check views vs stored procedures.</p>
<p>As for you Dave, keep up the good work</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xwalker</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-46391</link>
		<dc:creator><![CDATA[Xwalker]]></dc:creator>
		<pubDate>Fri, 06 Feb 2009 05:51:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-46391</guid>
		<description><![CDATA[Thank you for wonderful article.]]></description>
		<content:encoded><![CDATA[<p>Thank you for wonderful article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Durgesh Walker</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-46389</link>
		<dc:creator><![CDATA[Durgesh Walker]]></dc:creator>
		<pubDate>Fri, 06 Feb 2009 05:11:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-46389</guid>
		<description><![CDATA[Hi i am durgesh.....]]></description>
		<content:encoded><![CDATA[<p>Hi i am durgesh&#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sourabh Sachdeva</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-46319</link>
		<dc:creator><![CDATA[Sourabh Sachdeva]]></dc:creator>
		<pubDate>Wed, 04 Feb 2009 11:24:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-46319</guid>
		<description><![CDATA[Hey Pinal Nice artical man,

                   Its really useful for optimizing sql qry or procedure. But can anyone tell that why dave says that do  not to use Views or replace views with original source table?]]></description>
		<content:encoded><![CDATA[<p>Hey Pinal Nice artical man,</p>
<p>                   Its really useful for optimizing sql qry or procedure. But can anyone tell that why dave says that do  not to use Views or replace views with original source table?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sandle Wood</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-46086</link>
		<dc:creator><![CDATA[Sandle Wood]]></dc:creator>
		<pubDate>Wed, 28 Jan 2009 17:47:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-46086</guid>
		<description><![CDATA[Ya its a good for getting any correct output and also for optimization.....]]></description>
		<content:encoded><![CDATA[<p>Ya its a good for getting any correct output and also for optimization&#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ankit Agrawal</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-45980</link>
		<dc:creator><![CDATA[Ankit Agrawal]]></dc:creator>
		<pubDate>Sun, 25 Jan 2009 07:14:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-45980</guid>
		<description><![CDATA[I have the question about the following 2 points:

-Table should have minimum of one clustered index
Q: Can there be more than one clustered index on a table? If Yes, how and when they shall be used?


-Table should have appropriate amount of non-clustered index
Q: Creating unnecessarily huge number of non-clustered index(s) also brings the performance down for a table. Is it a good practice to create non-clustered index(s) on the fly in the stored procs as and when they should be needed? Could there be any downside of it?


Your blog is great... thanQ very much!]]></description>
		<content:encoded><![CDATA[<p>I have the question about the following 2 points:</p>
<p>-Table should have minimum of one clustered index<br />
Q: Can there be more than one clustered index on a table? If Yes, how and when they shall be used?</p>
<p>-Table should have appropriate amount of non-clustered index<br />
Q: Creating unnecessarily huge number of non-clustered index(s) also brings the performance down for a table. Is it a good practice to create non-clustered index(s) on the fly in the stored procs as and when they should be needed? Could there be any downside of it?</p>
<p>Your blog is great&#8230; thanQ very much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jaydee</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-45969</link>
		<dc:creator><![CDATA[jaydee]]></dc:creator>
		<pubDate>Sat, 24 Jan 2009 16:47:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-45969</guid>
		<description><![CDATA[hi pinal,
As you said that, we should have non clustered index.
Can you say how to add a non-clustered apart from primary key.]]></description>
		<content:encoded><![CDATA[<p>hi pinal,<br />
As you said that, we should have non clustered index.<br />
Can you say how to add a non-clustered apart from primary key.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: It Jobs</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-45899</link>
		<dc:creator><![CDATA[It Jobs]]></dc:creator>
		<pubDate>Thu, 22 Jan 2009 13:50:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-45899</guid>
		<description><![CDATA[In a high-load situation, inline SQL can cause high utilization of the network bandwidth - also, if you have a query with a length greather than 8000 chars (a coomplicated search, for example) you have to use a sproc.]]></description>
		<content:encoded><![CDATA[<p>In a high-load situation, inline SQL can cause high utilization of the network bandwidth &#8211; also, if you have a query with a length greather than 8000 chars (a coomplicated search, for example) you have to use a sproc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark S. Rasmussen</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-45866</link>
		<dc:creator><![CDATA[Mark S. Rasmussen]]></dc:creator>
		<pubDate>Wed, 21 Jan 2009 23:51:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-45866</guid>
		<description><![CDATA[&quot;Table should have primary key&quot;
How would you add more than one?

&quot;Remove any adhoc queries and use Stored Procedure instead&quot;
As long as there&#039;s no logic warranting a stored procedure, any prepared statement will perform just as well. Just make sure it&#039;s completely parameterized so we reuse the plan and avoid exhausting the plan cache with duplicates.]]></description>
		<content:encoded><![CDATA[<p>&#8220;Table should have primary key&#8221;<br />
How would you add more than one?</p>
<p>&#8220;Remove any adhoc queries and use Stored Procedure instead&#8221;<br />
As long as there&#8217;s no logic warranting a stored procedure, any prepared statement will perform just as well. Just make sure it&#8217;s completely parameterized so we reuse the plan and avoid exhausting the plan cache with duplicates.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: schmed</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-45852</link>
		<dc:creator><![CDATA[schmed]]></dc:creator>
		<pubDate>Wed, 21 Jan 2009 17:38:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-45852</guid>
		<description><![CDATA[In fact, with 2005 watch out for parameter sniffing with stored procs, what works wonderfully with a sql block, runs for minutes withing a stored proc. 

google &quot;parameter sniffing&quot;]]></description>
		<content:encoded><![CDATA[<p>In fact, with 2005 watch out for parameter sniffing with stored procs, what works wonderfully with a sql block, runs for minutes withing a stored proc. </p>
<p>google &#8220;parameter sniffing&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Sullivan</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-45851</link>
		<dc:creator><![CDATA[Brian Sullivan]]></dc:creator>
		<pubDate>Wed, 21 Jan 2009 17:18:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-45851</guid>
		<description><![CDATA[No Views? 

Far as I know the optimizer does not care. 

That said, the real problem occurs where people build views of views of views and end up going after the same table N times when once would do it.

Ad Hoc vs SP?

Ad Hoc queries are a security hole.

I can change the logic in the sp, adding temp tables, forcing joins etc. with having to redeploy code.

Don&#039;t forget 

Daily / weekly index rebuilds of overly fragmented indexes
Don&#039;t reindex, it only does leaf nodes and can cause creeping performance issues.]]></description>
		<content:encoded><![CDATA[<p>No Views? </p>
<p>Far as I know the optimizer does not care. </p>
<p>That said, the real problem occurs where people build views of views of views and end up going after the same table N times when once would do it.</p>
<p>Ad Hoc vs SP?</p>
<p>Ad Hoc queries are a security hole.</p>
<p>I can change the logic in the sp, adding temp tables, forcing joins etc. with having to redeploy code.</p>
<p>Don&#8217;t forget </p>
<p>Daily / weekly index rebuilds of overly fragmented indexes<br />
Don&#8217;t reindex, it only does leaf nodes and can cause creeping performance issues.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Miller</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-45845</link>
		<dc:creator><![CDATA[Ben Miller]]></dc:creator>
		<pubDate>Wed, 21 Jan 2009 15:38:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-45845</guid>
		<description><![CDATA[About the stored procedures, most of the time the performance gain is that when you use stored procedures you have to use parameters, and most people when they do not use stored procedures do not use Parameters, they just put the values inline.  This is a major reason stored procedures win over inline SQL.  But the other reason is that when you use inline SQL, the application is less maintainable when you find a logic problem in the retrieval of data.  You can just fix the stored procedure and not have to recompile the code.  But in a high load situation, stored procedures are preferred over inline SQL.]]></description>
		<content:encoded><![CDATA[<p>About the stored procedures, most of the time the performance gain is that when you use stored procedures you have to use parameters, and most people when they do not use stored procedures do not use Parameters, they just put the values inline.  This is a major reason stored procedures win over inline SQL.  But the other reason is that when you use inline SQL, the application is less maintainable when you find a logic problem in the retrieval of data.  You can just fix the stored procedure and not have to recompile the code.  But in a high load situation, stored procedures are preferred over inline SQL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-45841</link>
		<dc:creator><![CDATA[Tony]]></dc:creator>
		<pubDate>Wed, 21 Jan 2009 14:40:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-45841</guid>
		<description><![CDATA[I&#039;d to comment on some of the previous statements:

- Yes, dynamic queries are cached but they may not be reused and would be taking up space in the plan cache.  If you&#039;re going to use dynamic SQL, use parameterized queries which will promote plan reuse.

- Views perform about as well as accessing the tables directly as long as the query in the view has been optimized and the tables indexed appropriately.  However, using a view may require slightly more overhead than using the tables directly because the view must be rendered before the results are returned, similar to a derived table.

- Be careful when using indexes views as these views are materialized in the database.  This means that every time a base table in the index view is updated, the materialied table must also be updated (along with it&#039;s indexes).  Indexed views are great for read-only reporting or OLAP databases, but may cause performance issues with OLTP databases.

- Using triggers requires more overhead in the database than just incorporating the logic in a stored procedure.  That does not mean you should not use triggers, just use them wisely and only were necessary.]]></description>
		<content:encoded><![CDATA[<p>I&#8217;d to comment on some of the previous statements:</p>
<p>- Yes, dynamic queries are cached but they may not be reused and would be taking up space in the plan cache.  If you&#8217;re going to use dynamic SQL, use parameterized queries which will promote plan reuse.</p>
<p>- Views perform about as well as accessing the tables directly as long as the query in the view has been optimized and the tables indexed appropriately.  However, using a view may require slightly more overhead than using the tables directly because the view must be rendered before the results are returned, similar to a derived table.</p>
<p>- Be careful when using indexes views as these views are materialized in the database.  This means that every time a base table in the index view is updated, the materialied table must also be updated (along with it&#8217;s indexes).  Indexed views are great for read-only reporting or OLAP databases, but may cause performance issues with OLTP databases.</p>
<p>- Using triggers requires more overhead in the database than just incorporating the logic in a stored procedure.  That does not mean you should not use triggers, just use them wisely and only were necessary.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aswin</title>
		<link>http://blog.sqlauthority.com/2009/01/20/sql-server-rules-for-optimizining-any-query-best-practices-for-query-optimization/#comment-45833</link>
		<dc:creator><![CDATA[Aswin]]></dc:creator>
		<pubDate>Wed, 21 Jan 2009 11:25:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2061#comment-45833</guid>
		<description><![CDATA[Dave,

Good article, but can you please explain your statement &quot;Triggers should not be used if possible, incorporate the logic of trigger in stored procedure&quot; . 

Thanks,
Krash]]></description>
		<content:encoded><![CDATA[<p>Dave,</p>
<p>Good article, but can you please explain your statement &#8220;Triggers should not be used if possible, incorporate the logic of trigger in stored procedure&#8221; . </p>
<p>Thanks,<br />
Krash</p>
]]></content:encoded>
	</item>
</channel>
</rss>

