Will SQL Server 2005 Database Engine Tuning Advisor "tune" Temporary Tables?
I'm attempting to use Database Engine Tuning Advisor to tune my database. 开发者_如何学GoFrom the comments it's logging (it's just 40% into the analysis, after running all weekend) it appears that DTA is not capable of tuning operations on Temporary tables. Is that in fact the case?
No. Because in order to apply an index to a transient temporary table you would have to add the index to the script that used the temporary table. It can't just be applied to a non-permanent table as a set-and-forget operation.
What you can do is create a real table with the same name in your database and remove the creation of the temp table from scripts and replace with TRUNCATE TABLE. If you create this table, and then perform actions against it, the DTA will recommend indexing for the permanent table. You then script these recommended indexes, and add them to the temp table in your script.
Also: be aware that while the DTA does a pretty good job in most cases, it doesn't always get it right...
精彩评论