Why would upgrading from SQL Server 2000 to 2005 result in slower queries?

吃可爱长大的小学妹 提交于 2019-12-24 00:15:51

问题


Are there any common reasons why upgrading a database from SQL Server 2000 to SQL Server 2005 would result in slower queries? This is coming from an ASP.NET 1.1 application with hundred of tables, everything is indexed and seems to run well on the older version.


回答1:


After the upgrade first thing you need to do is update the statistics with full scan and rebuild the indexes or you will get suboptimal plans




回答2:


Are you certain that all of your indexes survived the upgrade? Are there any differences in hardware? Have you used the SQL Profiler to determine which queries are running slower to try to track down the problem?

There could be a lot of things. Without specific query examples and other information I don't think anyone will be able to help much.




回答3:


You may want to re-evaluate your indexes by looking at the execution plans of your most-troublesome queries. The SQL 2005 query optimizer may be coming up with completely different execution plans.

You should also make sure you update statistics on your entire database.




回答4:


A few things...

  1. What Service Pack are you on?
  2. Have you applied any additional Hotfixes or CUs?
  3. Did you change the db compatibility level from 80 to 90 during the upgrade?

If you are using server side cursors, be aware that there are some performance problems that can start to surface after upgrading from SQL Server 2000 to SQL Server 2005. If this is your situation, there are a couple of hotfixes that might help. Just search for SQL Server 2005 hotfixes and server side cursors.

Aside from that, always be sure to check db integrity after the upgrade, rebuild indexes and update stats.




回答5:


We just experienced this issue after upgrade from 2000 Ent SP4 to 2005 Std 64 bit SP2, a much more powerful server too (2 4-core, 32GB RAM)

SELECT query took 2~3 secs on 2000 and 20+ minutes (and still not finished) on 2005 Re-built ALL indexes, sp_updatestats, same results. Very strange, no index hints were used except NOLOCK The databases remained in 8.0 compatible mode on the 2005 box though

Restoring to another 2005 box as we speak to test




回答6:


Make sure that the queries and stored procedures you're running are not utilizing any index hints. Like everyone else has mentioned, the optimizer has changed between 2000 and 2005, so these hints may no longer be useful.




回答7:


Also, if all else fails, there is a bug in the 2005 optimizer addressed in SP2 cumulative update 6 (and requires applying 2 traceflags).




回答8:


You didn't say which edition you are running.

But if you just moved from a 2000 Standard or Enterprise edition to a 2005 Express edition; The Express edition only uses one processor. I jsut had this happen to me last week; one of my queries went from an already slow 1.5 seconds to 55 seconds! I ran the query plan, and the only difference was the parallel operations. Couldn't beleive the speed difference.



来源:https://stackoverflow.com/questions/489137/why-would-upgrading-from-sql-server-2000-to-2005-result-in-slower-queries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!