Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Query running slow in SQL 2005 after migrating from SQL 2000

 
   Database Help (Home) -> Server RSS
Next:  Merge Subscription fails: Shows different RPC in ..  
Author Message
Fraz

External


Since: Jan 28, 2008
Posts: 16



(Msg. 1) Posted: Mon Nov 24, 2008 12:05 pm
Post subject: Query running slow in SQL 2005 after migrating from SQL 2000
Archived from groups: microsoft>public>sqlserver>server (more info?)

We migrated a large database (more than 50GB) from SQL 2000 to SQL 2005 using
backup/restore method. After restore, we tested a query that takes 20-30
seconds in SQL 2000 whereas in SQL 2005 it takes forever. I have run DBCC
DBREINDEX, DBCC UPDATEUSAGE (0) & sp_updatestats on the database on SQL 2005
but still no improvement. On checking the Execution Plan, it is using
Clustered Index Seek on SQL 2000 whereas it is using Clustered Index Scan on
SQL 2005. It is SQL 2005 64-bit server with 2 quad CPU and 16GB memory. Any
suggestion would be appreciated.

 >> Stay informed about: Query running slow in SQL 2005 after migrating from SQL 2000 
Back to top
Login to vote
Plamen Ratchev

External


Since: Aug 20, 2008
Posts: 672



(Msg. 2) Posted: Mon Nov 24, 2008 5:47 pm
Post subject: Re: Query running slow in SQL 2005 after migrating from SQL 2000 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

If the query still runs slows after updating statistics, and there is no
chance you have a bad plan because of parameter sniffing, then you may
want to look at changing the query.

You can post the query here and someone may have suggestions on how to
improve.

Also, you can run the the query through the Database Tuning Advisor to
see the recommendations. In addition, if you get a parallel execution
plan you can test running on a single processor using the MAXDOP query
hint.

Here is an article with some interesting points:
http://rentacoder.com/CS/blogs/real_life_it/archive/2006/04/28/477.aspx

--
Plamen Ratchev
http://www.SQLStudio.com

 >> Stay informed about: Query running slow in SQL 2005 after migrating from SQL 2000 
Back to top
Login to vote
Jonathan Kehayias

External


Since: Nov 22, 2008
Posts: 28



(Msg. 3) Posted: Mon Nov 24, 2008 6:03 pm
Post subject: Re: Query running slow in SQL 2005 after migrating from SQL 2000 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

The other thing you can do is create a plan guide. I am not an expert on
this, and unfortunately I missed Kalen's session on it at PASS, but she
would be best to explain it. You can also look at:

http://www.microsoft.com/technet/prodtechnol/sql/2005/frcqupln.mspx

--
Jonathan Kehayias
SQL Server MVP
http://jmkehayias.blogspot.com
http://www.sqlclr.net


"Plamen Ratchev" wrote in message

> If the query still runs slows after updating statistics, and there is no
> chance you have a bad plan because of parameter sniffing, then you may
> want to look at changing the query.
>
> You can post the query here and someone may have suggestions on how to
> improve.
>
> Also, you can run the the query through the Database Tuning Advisor to see
> the recommendations. In addition, if you get a parallel execution plan you
> can test running on a single processor using the MAXDOP query hint.
>
> Here is an article with some interesting points:
> http://rentacoder.com/CS/blogs/real_life_it/archive/2006/04/28/477.aspx
>
> --
> Plamen Ratchev
> http://www.SQLStudio.com
 >> Stay informed about: Query running slow in SQL 2005 after migrating from SQL 2000 
Back to top
Login to vote
gan sub

External


Since: Mar 18, 2010
Posts: 1



(Msg. 4) Posted: Thu Mar 18, 2010 12:36 pm
Post subject: please share how you resolved [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Can you please share how you resolved the below issue you posted on Nov.24,2008. I am exactly having same problem but this is from sql 2000 to sql 2008.
-------------------------
Fra posted on Monday, November 24, 2008 3:05 PM

We migrated a large database (more than 50GB) from SQL 2000 to SQL 2005 using
backup/restore method. After restore, we tested a query that takes 20-30
seconds in SQL 2000 whereas in SQL 2005 it takes forever. I have run DBCC
DBREINDEX, DBCC UPDATEUSAGE (0) & sp_updatestats on the database on SQL 2005
but still no improvement. On checking the Execution Plan, it is using
Clustered Index Seek on SQL 2000 whereas it is using Clustered Index Scan on
SQL 2005. It is SQL 2005 64-bit server with 2 quad CPU and 16GB memory. Any
suggestion would be appreciated.




Fra wrote:

Query running slow in SQL 2005 after migrating from SQL 2000
24-Nov-08

We migrated a large database (more than 50GB) from SQL 2000 to SQL 2005 using
backup/restore method. After restore, we tested a query that takes 20-30
seconds in SQL 2000 whereas in SQL 2005 it takes forever. I have run DBCC
DBREINDEX, DBCC UPDATEUSAGE (0) & sp_updatestats on the database on SQL 2005
but still no improvement. On checking the Execution Plan, it is using
Clustered Index Seek on SQL 2000 whereas it is using Clustered Index Scan on
SQL 2005. It is SQL 2005 64-bit server with 2 quad CPU and 16GB memory. Any
suggestion would be appreciated.

Previous Posts In This Thread:

On Monday, November 24, 2008 3:05 PM
Fra wrote:

Query running slow in SQL 2005 after migrating from SQL 2000
We migrated a large database (more than 50GB) from SQL 2000 to SQL 2005 using
backup/restore method. After restore, we tested a query that takes 20-30
seconds in SQL 2000 whereas in SQL 2005 it takes forever. I have run DBCC
DBREINDEX, DBCC UPDATEUSAGE (0) & sp_updatestats on the database on SQL 2005
but still no improvement. On checking the Execution Plan, it is using
Clustered Index Seek on SQL 2000 whereas it is using Clustered Index Scan on
SQL 2005. It is SQL 2005 64-bit server with 2 quad CPU and 16GB memory. Any
suggestion would be appreciated.

On Monday, November 24, 2008 5:47 PM
Plamen Ratchev wrote:

If the query still runs slows after updating statistics, and there is no
If the query still runs slows after updating statistics, and there is no
chance you have a bad plan because of parameter sniffing, then you may
want to look at changing the query.

You can post the query here and someone may have suggestions on how to
improve.

Also, you can run the the query through the Database Tuning Advisor to
see the recommendations. In addition, if you get a parallel execution
plan you can test running on a single processor using the MAXDOP query
hint.

Here is an article with some interesting points:
http://rentacoder.com/CS/blogs/real_life_it/archive/2006/04/28/477.aspx

--
Plamen Ratchev
http://www.SQLStudio.com

On Monday, November 24, 2008 6:03 PM
Jonathan Kehayias wrote:

The other thing you can do is create a plan guide.
The other thing you can do is create a plan guide. I am not an expert on
this, and unfortunately I missed Kalen's session on it at PASS, but she
would be best to explain it. You can also look at:

http://www.microsoft.com/technet/prodtechnol/sql/2005/frcqupln.mspx

--
Jonathan Kehayias
SQL Server MVP
http://jmkehayias.blogspot.com
http://www.sqlclr.net


"Plamen Ratchev" wrote in message



Submitted via EggHeadCafe - Software Developer Portal of Choice
Adding WCF Service References
http://www.eggheadcafe.com/tutorials/aspnet/a1647f10-9aa4-4b0c-bbd9-df...a9fab8e
 >> Stay informed about: Query running slow in SQL 2005 after migrating from SQL 2000 
Back to top
Login to vote
Uri Dimant

External


Since: Aug 24, 2003
Posts: 1744



(Msg. 5) Posted: Sun Mar 21, 2010 6:25 am
Post subject: Re: please share how you resolved [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

gan
Yep, it could happen, perhaps you need to re-write the query. Can you show
us the actual query along with an execution plan?



<gan sub> wrote in message ...
> Can you please share how you resolved the below issue you posted on
> Nov.24,2008. I am exactly having same problem but this is from sql 2000 to
> sql 2008.
> -------------------------
> Fra posted on Monday, November 24, 2008 3:05 PM
>
> We migrated a large database (more than 50GB) from SQL 2000 to SQL 2005
> using
> backup/restore method. After restore, we tested a query that takes 20-30
> seconds in SQL 2000 whereas in SQL 2005 it takes forever. I have run DBCC
> DBREINDEX, DBCC UPDATEUSAGE (0) & sp_updatestats on the database on SQL
> 2005
> but still no improvement. On checking the Execution Plan, it is using
> Clustered Index Seek on SQL 2000 whereas it is using Clustered Index Scan
> on
> SQL 2005. It is SQL 2005 64-bit server with 2 quad CPU and 16GB memory.
> Any
> suggestion would be appreciated.
>
>
>
>
> Fra wrote:
>
> Query running slow in SQL 2005 after migrating from SQL 2000
> 24-Nov-08
>
> We migrated a large database (more than 50GB) from SQL 2000 to SQL 2005
> using
> backup/restore method. After restore, we tested a query that takes 20-30
> seconds in SQL 2000 whereas in SQL 2005 it takes forever. I have run DBCC
> DBREINDEX, DBCC UPDATEUSAGE (0) & sp_updatestats on the database on SQL
> 2005
> but still no improvement. On checking the Execution Plan, it is using
> Clustered Index Seek on SQL 2000 whereas it is using Clustered Index Scan
> on
> SQL 2005. It is SQL 2005 64-bit server with 2 quad CPU and 16GB memory.
> Any
> suggestion would be appreciated.
>
> Previous Posts In This Thread:
>
> On Monday, November 24, 2008 3:05 PM
> Fra wrote:
>
> Query running slow in SQL 2005 after migrating from SQL 2000
> We migrated a large database (more than 50GB) from SQL 2000 to SQL 2005
> using
> backup/restore method. After restore, we tested a query that takes 20-30
> seconds in SQL 2000 whereas in SQL 2005 it takes forever. I have run DBCC
> DBREINDEX, DBCC UPDATEUSAGE (0) & sp_updatestats on the database on SQL
> 2005
> but still no improvement. On checking the Execution Plan, it is using
> Clustered Index Seek on SQL 2000 whereas it is using Clustered Index Scan
> on
> SQL 2005. It is SQL 2005 64-bit server with 2 quad CPU and 16GB memory.
> Any
> suggestion would be appreciated.
>
> On Monday, November 24, 2008 5:47 PM
> Plamen Ratchev wrote:
>
> If the query still runs slows after updating statistics, and there is no
> If the query still runs slows after updating statistics, and there is no
> chance you have a bad plan because of parameter sniffing, then you may
> want to look at changing the query.
>
> You can post the query here and someone may have suggestions on how to
> improve.
>
> Also, you can run the the query through the Database Tuning Advisor to
> see the recommendations. In addition, if you get a parallel execution
> plan you can test running on a single processor using the MAXDOP query
> hint.
>
> Here is an article with some interesting points:
> http://rentacoder.com/CS/blogs/real_life_it/archive/2006/04/28/477.aspx
>
> --
> Plamen Ratchev
> http://www.SQLStudio.com
>
> On Monday, November 24, 2008 6:03 PM
> Jonathan Kehayias wrote:
>
> The other thing you can do is create a plan guide.
> The other thing you can do is create a plan guide. I am not an expert on
> this, and unfortunately I missed Kalen's session on it at PASS, but she
> would be best to explain it. You can also look at:
>
> http://www.microsoft.com/technet/prodtechnol/sql/2005/frcqupln.mspx
>
> --
> Jonathan Kehayias
> SQL Server MVP
> http://jmkehayias.blogspot.com
> http://www.sqlclr.net
>
>
> "Plamen Ratchev" wrote in message
>
>
>
> Submitted via EggHeadCafe - Software Developer Portal of Choice
> Adding WCF Service References
> http://www.eggheadcafe.com/tutorials/aspnet/a1647f10-9aa4-4b0c-bbd9-df...a9fab8e
 >> Stay informed about: Query running slow in SQL 2005 after migrating from SQL 2000 
Back to top
Login to vote
Nicolae Bolboaca

External


Since: Jan 13, 2011
Posts: 1



(Msg. 6) Posted: Thu Jan 13, 2011 11:25 am
Post subject: Re: ganYep, it could happen, perhaps you need to re-write the query. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I had the same problem and after a long research i didn't find a solution.
I did reindex, update statistics with full scan, but nothing. My issue was related to Ntext fields, and that made me search in the wrong place my answer that i need.

As a last resort i plan to drop all indexes and all statistics.

I start with the statistics, and what do you think? it was sufficient Smile. Why you'll ask? Smile
Well....
While Restoring the DB on SQL2005 i had Statistics ON, and SQL made statistics for every column on almost every table, and while running some queries after restore, it used those bad stats.

SO If you had Statistics On while restoring a DB on SQL2005, after the restore ends, DROP all Statistics that are named _WA_Sys_xxxxxx . That will do.

Best regards,

> On Monday, November 24, 2008 3:05 PM Fra wrote:

> We migrated a large database (more than 50GB) from SQL 2000 to SQL 2005 using
> backup/restore method. After restore, we tested a query that takes 20-30
> seconds in SQL 2000 whereas in SQL 2005 it takes forever. I have run DBCC
> DBREINDEX, DBCC UPDATEUSAGE (0) & sp_updatestats on the database on SQL 2005
> but still no improvement. On checking the Execution Plan, it is using
> Clustered Index Seek on SQL 2000 whereas it is using Clustered Index Scan on
> SQL 2005. It is SQL 2005 64-bit server with 2 quad CPU and 16GB memory. Any
> suggestion would be appreciated.


>> On Monday, November 24, 2008 5:47 PM Plamen Ratchev wrote:

>> If the query still runs slows after updating statistics, and there is no
>> chance you have a bad plan because of parameter sniffing, then you may
>> want to look at changing the query.
>>
>> You can post the query here and someone may have suggestions on how to
>> improve.
>>
>> Also, you can run the the query through the Database Tuning Advisor to
>> see the recommendations. In addition, if you get a parallel execution
>> plan you can test running on a single processor using the MAXDOP query
>> hint.
>>
>> Here is an article with some interesting points:
>> http://rentacoder.com/CS/blogs/real_life_it/archive/2006/04/28/477.aspx
>>
>> --
>> Plamen Ratchev
>> http://www.SQLStudio.com


>>> On Monday, November 24, 2008 6:03 PM Jonathan Kehayias wrote:

>>> The other thing you can do is create a plan guide. I am not an expert on
>>> this, and unfortunately I missed Kalen's session on it at PASS, but she
>>> would be best to explain it. You can also look at:
>>>
>>> http://www.microsoft.com/technet/prodtechnol/sql/2005/frcqupln.mspx
>>>
>>> --
>>> Jonathan Kehayias
>>> SQL Server MVP
>>> http://jmkehayias.blogspot.com
>>> http://www.sqlclr.net
>>>
>>>
>>> "Plamen Ratchev" wrote in message
>>>


>>>> On Thursday, March 18, 2010 3:35 PM gan sub wrote:

>>>> Can you please share how you resolved the below issue you posted on Nov.24,2008. I am exactly having same problem but this is from sql 2000 to sql 2008.
>>>>
>>>> -------------------------
>>>>
>>>> Fra posted on Monday, November 24, 2008 3:05 PM
>>>>
>>>>
>>>>
>>>> We migrated a large database (more than 50GB) from SQL 2000 to SQL 2005 using
>>>>
>>>> backup/restore method. After restore, we tested a query that takes 20-30
>>>>
>>>> seconds in SQL 2000 whereas in SQL 2005 it takes forever. I have run DBCC
>>>>
>>>> DBREINDEX, DBCC UPDATEUSAGE (0) & sp_updatestats on the database on SQL 2005
>>>>
>>>> but still no improvement. On checking the Execution Plan, it is using
>>>>
>>>> Clustered Index Seek on SQL 2000 whereas it is using Clustered Index Scan on
>>>>
>>>> SQL 2005. It is SQL 2005 64-bit server with 2 quad CPU and 16GB memory. Any
>>>>
>>>> suggestion would be appreciated.


>>>>> On Sunday, March 21, 2010 5:35 AM Uri Dimant wrote:

>>>>> gan
>>>>> Yep, it could happen, perhaps you need to re-write the query. Can you show
>>>>> us the actual query along with an execution plan?


>>>>> Submitted via EggHeadCafe
>>>>> Entity Framework Code-First Library CTP 5 Quick Facts
>>>>> http://www.eggheadcafe.com/tutorials/aspnet/1be19af6-7384-4eca-9076-d1...d0638cc
 >> Stay informed about: Query running slow in SQL 2005 after migrating from SQL 2000 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Query running slow in production - Hi, First here is my setup. I have a two node active/passive SQL 2005 Enterprise 64bit cluster. There is a database (DB1) that is set up for snapshot replication to another SQL 2005 64 bit server. The replication runs once a night around 2:00am. I also...

Slow response when running query from Intranet app - Hello! I would like to know if anyone can shed some light for me. I have an SQL 2000 sever that is running on a P3 x350 IBM server with 4g of ram and Windows 2000 Adv. Server SP4. We have an inhouse app that is only accessed internally that users run...

Query works in 2000 but not 2005 - I noticed that some queries work in 2000, but not in 2005, for example SELECT columnA, columnB, case when columnC = 'BLAH' then dbo.fn_func(columnD) sum(columnE) FROM TableA GROUP BY columnA,...

HELP : Remote query from 2005 to 2000 returns wrong record.. - Hi there I came across this bug and could not find a solution, and I'm blocked. Can anyone help ? I have a table with TABLE CONSTRAINT, located at a SQL 2000 (SP3 or SP4) server. When I make a remote query from a (linked) SQL 2005 server (SP1 or SP2),...

SQL queries are slow in SQL Server 2005 when compared with.. - Hi, I have installed SQL2000 and SQL2005 on the same computer accessing the same DB When run the following simple queries the performance is as follows Could some one please advice on how improve the performance on these queries to run on SQL200...
   Database Help (Home) -> Server All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]