﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / T-SQL (SS2K5)  / Maintenance Plan Question / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 15:19:40 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Maintenance Plan Question</title><link>http://www.sqlservercentral.com/Forums/Topic1422400-338-1.aspx</link><description>Do you know why dropping and recreating makes things go faster, and they gradually slow down?Do you have maintenance that updates statistics, and reindexes, if needed?Plus, if the code within the view is indicative of your coding, there is likely a lot of optimization that can occur.You are using the old style joins, which functionally are the same, but are not very readable. Also, doing the join on the substring(sn, 7, 5) is referred to as NON-sargable.  Please research this further. I took the liberty of re-writing thie code.  There are many other ways to do this, but since I am at the office, you are only getting the "quick" version.select 	p.model, 	i.defect_title, 	p.item, 	d.sn, 	d.dateinspected, 	t.type, 	i.defect_idfrom (SELECT sn, 		substring(sn, 7, 5) as [sn_join]		dateinspected, 		defect_id 	FROM productiondefect) DINNER JOIN assignworkorder p ON d.[sn_join] = p.workorderINNER JOIN tlkp_defects i ON d.defect_id = i.defect_idINNER JOIN tlkp_item as t ON p.item = t.item </description><pubDate>Thu, 21 Feb 2013 13:21:22 GMT</pubDate><dc:creator>Michael L John</dc:creator></item><item><title>RE: Maintenance Plan Question</title><link>http://www.sqlservercentral.com/Forums/Topic1422400-338-1.aspx</link><description>Rewrite the query or maybe creating a computed column on [i][b]substring(dsn, 7, 5)[/b][/i] and creating index on that column will help this query.</description><pubDate>Thu, 21 Feb 2013 13:17:36 GMT</pubDate><dc:creator>e4d4</dc:creator></item><item><title>RE: Maintenance Plan Question</title><link>http://www.sqlservercentral.com/Forums/Topic1422400-338-1.aspx</link><description>[code="sql"]GODrop view AssemblyDefectsGOcreate View AssemblyDefects AS(select p.model, i.defect_title, p.item, d.sn, d.dateinspected, t.type, i.defect_idfrom productiondefect as d, assignworkorder as p, tlkp_defects as i, tlkp_item as twhere substring(d.sn, 7, 5) = p.workorderand d.defect_id = i.defect_idand  p.item = t.item) GODROP Table ADRGOselect *into ADRfrom AssemblyDefects[/code]</description><pubDate>Thu, 21 Feb 2013 13:01:25 GMT</pubDate><dc:creator>kabaari</dc:creator></item><item><title>RE: Maintenance Plan Question</title><link>http://www.sqlservercentral.com/Forums/Topic1422400-338-1.aspx</link><description>I'd say that the first thing you should try is some query optimisation - maybe you can get the query running fast enough so that you don't need to do this.Otherwise, I'd consider creating a physical table which has the query's structure and then building a stored proc which truncates/rebuilds this table using your query. Then you can call this stored proc as part of your Agent job &amp; then use the table in what comes next ...</description><pubDate>Thu, 21 Feb 2013 02:07:12 GMT</pubDate><dc:creator>Phil Parkin</dc:creator></item><item><title>Maintenance Plan Question</title><link>http://www.sqlservercentral.com/Forums/Topic1422400-338-1.aspx</link><description>I have a extremely time consuming query that times out whenever it runs. To cure the issue, I created a view of the lengthy query then a table of the view. Next, I plan to add a maintenance plan that would Drop the view then create the view, then drop the table the create the table. Is this the most efficient method to achieve my goal of improve performance? The resulting query return large chunks of data very quickly versus timing out. I plan to post the plan some time in the morning.Thanks.</description><pubDate>Wed, 20 Feb 2013 22:28:40 GMT</pubDate><dc:creator>kabaari</dc:creator></item></channel></rss>