Groups | Blog | Home
all groups > sql server programming > october 2006 >

sql server programming : Poor Execution Plan in SQL Server 2005


Leila
10/5/2006 10:58:01 PM
Hi,
We have a database in SQL Server 2000. I made a copy of this
database(mdf,ndf,ldf) and attached it to SQL Server 2005 on the same
machine. When I try one particular SP in both of them, SQL Server 2000
performs almost 2.5 times faster than 2005. The execution plan in 2005
contains HASH physical operators while 2000 has much better plan. I'm
wondered that why this can happen while all of indexes are exactly the same
in both databases.
A few days ago, I heard from a colleague that he had experienced bad
performance after upgrading the database of a customer to SQL Server 2005.
They were forced to move the database to 2000 again! I didn't believe it but
now I'm experiencing a real one!
Any help would be greatly appreciated.
Leila

Greg Linwood
10/6/2006 12:00:00 AM
Hi Leila

Are you aware that upgraded databases have all of their index statistics
disabled & that you have to either recompute statistics or rebuild the
indexes before SQL Server 2005 will use any indexes? You didn't mention
this, so perhaps youre problem is this simple?

Regards,
Greg Linwood
SQL Server MVP
http://blogs.sqlserver.org.au/blogs/greg_linwood

[quoted text, click to view]

Greg Linwood
10/6/2006 12:00:00 AM
That should work ok assuming the DB isn't too big & you're not trying to
squeeze the task into a small window.

Another option is to rebuild the indexes, which might achieve some
defragmentation as well, but I'd try the first option you suggested first.

Regards,
Greg Linwood
SQL Server MVP
http://blogs.sqlserver.org.au/blogs/greg_linwood

[quoted text, click to view]

Leila
10/6/2006 12:00:00 AM
Actually once I created a new database in SQL Server 2005 and imported
tables from 2000. Then generated index scripts from 2000 and applied to
2005. This way I think there must not be need to updating statistics. The
performance improved a little but still the execution plan in 2005 is poor
and about 2 or 1.5 times slower than 2000!




[quoted text, click to view]

Leila
10/6/2006 12:00:00 AM
Actually once I created a new database in SQL Server 2005 and imported
tables from 2000. Then generated index scripts from 2000 and applied to
2005. This way I think there must not be need to updating statistics. The
performance improved a little but still the execution plan in 2005 is poor
and about 2 or 1.5 times slower than 2000!




[quoted text, click to view]

Tracy McKibben
10/6/2006 12:00:00 AM
[quoted text, click to view]

So, you're not TRULY comparing the performance of identical databases
then. I would suggest comparing the 2005 execution plan for this query
to that from 2000. What's different? Could you possibly have missed an
index in your migration? It might be worth migrating the database
properly, by doing a backup of the 2000 database, restoring it to 2005,
and then updating the statistics.


--
Tracy McKibben
MCDBA
Leila
10/6/2006 5:43:37 AM
Thanks Greg,
Do you mean if I perform:
UPDATE STATISTICS MyTable WITH FULLSCAN
on every table, will correct the problem? Or other statements must be used
for indexes??




[quoted text, click to view]

AddThis Social Bookmark Button