Friday, March 23, 2012
Problems Defragging Indices (SQL2005 64-bit)
I have just migrated a database from SQL 2000 32 bit to SQL 2005 64 bit. I
also upgraded the compatability level to 9. Performance was immediately
horrible in terms of query execution.
Trying to solve the issue, I ran a query to retrieve indices with avgfrag >
10%. I then tried rebuilding the indices with ALTER INDEX, and ran my query
again. The avgfrag had NOT CHANGED.
What am I doing wrong?
While we're at it, I got several timeout errors from clients connecting with
ADO.NET from with the network. Their app's connection string specifies a
timeout of 120 sec, but they were timing out well before this. Just before
my database/server "upgrade", this was NOT happening. Where to best change
this to prevent further timeouts until I can get my indices and stats in
better shape?
Thanks.
John
Hi John
Have you checked local connectivity and connectivity from (say) query
analyser to the new server? Is remote access enabled?
When migrating did you trasfer logins/users correctly, do you have orphaned
users? Have you tried scripting/recreating the indexes, I would also consider
doing this for all views/stored procedures/functions also. Make sure that you
have updated the usage and statistics as well.
John
"JT" wrote:
> Hi all,
> I have just migrated a database from SQL 2000 32 bit to SQL 2005 64 bit. I
> also upgraded the compatability level to 9. Performance was immediately
> horrible in terms of query execution.
> Trying to solve the issue, I ran a query to retrieve indices with avgfrag >
> 10%. I then tried rebuilding the indices with ALTER INDEX, and ran my query
> again. The avgfrag had NOT CHANGED.
> What am I doing wrong?
> While we're at it, I got several timeout errors from clients connecting with
> ADO.NET from with the network. Their app's connection string specifies a
> timeout of 120 sec, but they were timing out well before this. Just before
> my database/server "upgrade", this was NOT happening. Where to best change
> this to prevent further timeouts until I can get my indices and stats in
> better shape?
> Thanks.
> --
> John
|||Hello John,
I understand that you tried to use "alter index ...rebuild all" statement
to some indexes, and its fragment is not changed. Also, you saw performance
degration after database migration to 2005 64 bit version from SQL 2000.
You encountered timout errors less than 120s from clients though connection
string specifies 120s. If I'm off base, please correct me.
Did you use sys.dm_db_index_physical_stats or dbcc showcontig to get the
fragment information? Based on my experience, if a table does not include
clustered index, it may have large logical fragment and low density.
However, this does not necessarily indicate the tables/indexes are not
efficient for all queries. Generally, rebuild index for this situation does
not change the logical fragment value. You may consider use a different
fillfactor but I don't think this may be related to the performance issue
you encountered.
Also, does the issue occurs on some specific queries? Does 2 servers have
the same load? Did you see any bottleneck in memory/IO/CPU? The whitepaper
of performance troubleshooting in 2005 is as following:
Troubleshooting Performance Problems in SQL Server 2005
http://www.microsoft.com/technet/pro.../tsprfprb.mspx
First, please install SP1 on the server if it is not installed since many
known issues are addressed in sp1.
you may want to update the statistics information by using "update
statistics" statment with "fullscan" option to see if it does any
difference. You may also want to change the compatability level to 80 to
test. On the other thand, if the old server exist, you may want to compare
the execution plan on both servers to see if there is any differences:
HOW TO: Troubleshoot Slow-Running Queries on SQL Server 7.0 or Later
http://support.microsoft.com/?id=243589
Please run sp_configure on both server to see if there is any difference.
You'd like to change "max degree of parallelism" to 1 if you have
mulitprocessors on the server to see the result.
As for tiemout issue, you may first check if the issue occurs on local
console of SQL Server if possible. Also, did you set commandtimeout or
connectiontimout? Usually commandtimeout might be cause of this issue of
long running quries.
http://msdn.microsoft.com/library/de...us/ado270/htm/
mdprocommandtimeout.asp
To isolate the client/server issue, you may want to install latest mdac and
sql native client on different machine, and make sure the issue occurs on
different clients
How to obtain the latest MDAC 2.8 service pack
http://support.microsoft.com/kb/884103/
http://www.microsoft.com/downloads/d...5AA-B4BD-4705-
AA0A-B477BA72A9CB&displaylang=en
If you isolate this to be a server side issue, you may want to check if you
encounter the following known issue and get fix from it to see if you
encoutnered the issue.
FIX: The internal deadlock monitor may not detect a deadlock between two or
more sessions in SQL Server 2005
http://support.microsoft.com/kb/915918
If you have any update, please feel free to let's know. Thank you.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications
<http://msdn.microsoft.com/subscripti...s/default.aspx>.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
<http://msdn.microsoft.com/subscripti...t/default.aspx>.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Hello John,
I'm still interested in this issue. Did you try to solve the issue in the
weekend? If the issue persists, please get the informaiton I mentioend so
that we may further troubleshoot the issue. If you have other priorites,
please also let's know and we may work on the problem a little alter. Thank
you.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====
|||Hi Peter,
I have largely resolved the issue. The steps I took included
1. greatly expanding the resources of tempdb, giving it eight equally sized
200MB mdf/ndf files to work with on a RAID 1/0 LUN.
2. Using NOEXPAND to force the optimizer to choose indexed views. (This
made a HUGE difference - like 1000% performance gains.) You can see my post
on this in SQL Server.Programming under Indexed View Issue, dated 11/22/2006).
3. Identifying an error in the 2005 scripting wizard which has been sending
me on a tail-chase regarding indices on Indexed Views. You can see my post
on this at SQL Server.Server under WARNING-SCRIPTING ENGINE UNRELIABLE, dated
11/26/2006.
4. Reading Itzak Ben-Gan's two books and doing a lot of optimization work.
Bottom line, I had a particularly gruesome query that ran in 7 seconds with
SQL 2000, and then went up to 25 seconds in SQL 2005 x64. I got it down to
1.7 seconds now, still using SQL 2005 x64. This is just one of many examples.
Thanks for your help.
John
"Peter Yang [MSFT]" wrote:
> Hello John,
> I'm still interested in this issue. Did you try to solve the issue in the
> weekend? If the issue persists, please get the informaiton I mentioend so
> that we may further troubleshoot the issue. If you have other priorites,
> please also let's know and we may work on the problem a little alter. Thank
> you.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Partner Support
>
> ================================================== ===
> This posting is provided "AS IS" with no warranties, and confers no rights.
> ================================================== ====
>
>
|||Hi John
Thanks for the feed back,
Links to the previous threads:
2. Indexed View Issue http://tinyurl.com/yj4qvn
3. WARNING-SCRIPTING ENGINE UNRELIABLE - http://tinyurl.com/wu6aq
IMO Itzik's books in the Inside SQL Server 2005 series are must buys for any
Programmer/DBA using SQL Server 2005.
John
"JT" wrote:
[vbcol=seagreen]
> Hi Peter,
> I have largely resolved the issue. The steps I took included
> 1. greatly expanding the resources of tempdb, giving it eight equally sized
> 200MB mdf/ndf files to work with on a RAID 1/0 LUN.
> 2. Using NOEXPAND to force the optimizer to choose indexed views. (This
> made a HUGE difference - like 1000% performance gains.) You can see my post
> on this in SQL Server.Programming under Indexed View Issue, dated 11/22/2006).
> 3. Identifying an error in the 2005 scripting wizard which has been sending
> me on a tail-chase regarding indices on Indexed Views. You can see my post
> on this at SQL Server.Server under WARNING-SCRIPTING ENGINE UNRELIABLE, dated
> 11/26/2006.
> 4. Reading Itzak Ben-Gan's two books and doing a lot of optimization work.
> Bottom line, I had a particularly gruesome query that ran in 7 seconds with
> SQL 2000, and then went up to 25 seconds in SQL 2005 x64. I got it down to
> 1.7 seconds now, still using SQL 2005 x64. This is just one of many examples.
> Thanks for your help.
>
> --
> John
>
> "Peter Yang [MSFT]" wrote:
|||Hello John,
Thank you for sharing your experience on this issue and this shall
defenitely benefit the community. :-)
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====
sql
Problems Defragging Indices (SQL2005 64-bit)
I have just migrated a database from SQL 2000 32 bit to SQL 2005 64 bit. I
also upgraded the compatability level to 9. Performance was immediately
horrible in terms of query execution.
Trying to solve the issue, I ran a query to retrieve indices with avgfrag >
10%. I then tried rebuilding the indices with ALTER INDEX, and ran my query
again. The avgfrag had NOT CHANGED.
What am I doing wrong?
While we're at it, I got several timeout errors from clients connecting with
ADO.NET from with the network. Their app's connection string specifies a
timeout of 120 sec, but they were timing out well before this. Just before
my database/server "upgrade", this was NOT happening. Where to best change
this to prevent further timeouts until I can get my indices and stats in
better shape?
Thanks.
--
JohnHi John
Have you checked local connectivity and connectivity from (say) query
analyser to the new server? Is remote access enabled?
When migrating did you trasfer logins/users correctly, do you have orphaned
users? Have you tried scripting/recreating the indexes, I would also conside
r
doing this for all views/stored procedures/functions also. Make sure that yo
u
have updated the usage and statistics as well.
John
"JT" wrote:
> Hi all,
> I have just migrated a database from SQL 2000 32 bit to SQL 2005 64 bit.
I
> also upgraded the compatability level to 9. Performance was immediately
> horrible in terms of query execution.
> Trying to solve the issue, I ran a query to retrieve indices with avgfrag
> 10%. I then tried rebuilding the indices with ALTER INDEX, and ran my que
ry
> again. The avgfrag had NOT CHANGED.
> What am I doing wrong?
> While we're at it, I got several timeout errors from clients connecting wi
th
> ADO.NET from with the network. Their app's connection string specifies a
> timeout of 120 sec, but they were timing out well before this. Just befor
e
> my database/server "upgrade", this was NOT happening. Where to best chang
e
> this to prevent further timeouts until I can get my indices and stats in
> better shape?
> Thanks.
> --
> John|||Hello John,
I understand that you tried to use "alter index ...rebuild all" statement
to some indexes, and its fragment is not changed. Also, you saw performance
degration after database migration to 2005 64 bit version from SQL 2000.
You encountered timout errors less than 120s from clients though connection
string specifies 120s. If I'm off base, please correct me.
Did you use sys.dm_db_index_physical_stats or dbcc showcontig to get the
fragment information? Based on my experience, if a table does not include
clustered index, it may have large logical fragment and low density.
However, this does not necessarily indicate the tables/indexes are not
efficient for all queries. Generally, rebuild index for this situation does
not change the logical fragment value. You may consider use a different
fillfactor but I don't think this may be related to the performance issue
you encountered.
Also, does the issue occurs on some specific queries? Does 2 servers have
the same load? Did you see any bottleneck in memory/IO/CPU? The whitepaper
of performance troubleshooting in 2005 is as following:
Troubleshooting Performance Problems in SQL Server 2005
http://www.microsoft.com/technet/pr...5/tsprfprb.mspx
First, please install SP1 on the server if it is not installed since many
known issues are addressed in sp1.
you may want to update the statistics information by using "update
statistics" statment with "fullscan" option to see if it does any
difference. You may also want to change the compatability level to 80 to
test. On the other thand, if the old server exist, you may want to compare
the execution plan on both servers to see if there is any differences:
HOW TO: Troubleshoot Slow-Running Queries on SQL Server 7.0 or Later
http://support.microsoft.com/?id=243589
Please run sp_configure on both server to see if there is any difference.
You'd like to change "max degree of parallelism" to 1 if you have
mulitprocessors on the server to see the result.
As for tiemout issue, you may first check if the issue occurs on local
console of SQL Server if possible. Also, did you set commandtimeout or
connectiontimout? Usually commandtimeout might be cause of this issue of
long running quries.
http://msdn.microsoft.com/library/d...-us/ado270/htm/
mdprocommandtimeout.asp
To isolate the client/server issue, you may want to install latest mdac and
sql native client on different machine, and make sure the issue occurs on
different clients
How to obtain the latest MDAC 2.8 service pack
http://support.microsoft.com/kb/884103/
http://www.microsoft.com/downloads/...A5AA-B4BD-4705-
AA0A-B477BA72A9CB&displaylang=en
If you isolate this to be a server side issue, you may want to check if you
encounter the following known issue and get fix from it to see if you
encoutnered the issue.
FIX: The internal deadlock monitor may not detect a deadlock between two or
more sessions in SQL Server 2005
http://support.microsoft.com/kb/915918
If you have any update, please feel free to let's know. Thank you.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Community Support
========================================
==========
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications
<http://msdn.microsoft.com/subscript...ps/default.aspx>.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
<http://msdn.microsoft.com/subscript...rt/default.aspx>.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.|||Thank you John and Peter. The problem seems to be isolated to several
queries that rely on Indexed Views for their execution plan. The indices on
these Indexed Views really seem to be the problem. I was able to make quite
a bit of headway by disposing of several of the indices in these views, and
taking advantage of the new INCLUDE feature. Things still do not run as fas
t
(about 50% SLOWER) as they did on SQL 2000 32 bit, but at least I am no
longer getting the timeouts.
--
John
"Peter Yang [MSFT]" wrote:
> Hello John,
> I understand that you tried to use "alter index ...rebuild all" statement
> to some indexes, and its fragment is not changed. Also, you saw performanc
e
> degration after database migration to 2005 64 bit version from SQL 2000.
> You encountered timout errors less than 120s from clients though connectio
n
> string specifies 120s. If I'm off base, please correct me.
> Did you use sys.dm_db_index_physical_stats or dbcc showcontig to get the
> fragment information? Based on my experience, if a table does not include
> clustered index, it may have large logical fragment and low density.
> However, this does not necessarily indicate the tables/indexes are not
> efficient for all queries. Generally, rebuild index for this situation doe
s
> not change the logical fragment value. You may consider use a different
> fillfactor but I don't think this may be related to the performance issue
> you encountered.
> Also, does the issue occurs on some specific queries? Does 2 servers have
> the same load? Did you see any bottleneck in memory/IO/CPU? The whitepaper
> of performance troubleshooting in 2005 is as following:
> Troubleshooting Performance Problems in SQL Server 2005
> http://www.microsoft.com/technet/pr...5/tsprfprb.mspx
> First, please install SP1 on the server if it is not installed since many
> known issues are addressed in sp1.
> you may want to update the statistics information by using "update
> statistics" statment with "fullscan" option to see if it does any
> difference. You may also want to change the compatability level to 80 to
> test. On the other thand, if the old server exist, you may want to compare
> the execution plan on both servers to see if there is any differences:
> HOW TO: Troubleshoot Slow-Running Queries on SQL Server 7.0 or Later
> http://support.microsoft.com/?id=243589
> Please run sp_configure on both server to see if there is any difference.
> You'd like to change "max degree of parallelism" to 1 if you have
> mulitprocessors on the server to see the result.
> As for tiemout issue, you may first check if the issue occurs on local
> console of SQL Server if possible. Also, did you set commandtimeout or
> connectiontimout? Usually commandtimeout might be cause of this issue of
> long running quries.
> http://msdn.microsoft.com/library/d...com/kb/884103/
> http://www.microsoft.com/downloads/...t.com/kb/915918
> If you have any update, please feel free to let's know. Thank you.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Community Support
> ========================================
==========
> Get notification to my posts through email? Please refer to
> l]
> ications
> <[url]http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx" target="_blank">http://msdn.microsoft.com/subscript...ps/default.aspx>.
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> <http://msdn.microsoft.com/subscript...rt/default.aspx>.
> ========================================
==========
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>|||UNBELIEVABLE! Last night I had a particular problem sproc running in 15
seconds on my 2GB laptop with 64 bit CPU and SQL Server 2005 64 bit. I
drop/created the underlying indexed views on my 4 CPU XEON 3.3Ghz with 15k
discs DELL 6850, 15k SAN discs, separated mdfs, ldfs, and tempdb on RAID 1 o
r
RAID 10 production clustered setup, and the best I can get is 45 seconds wit
h
the same procedure. This is even after a full stats update and index
rebuilding. What am I doing wrong? This occurs whether am I running from a
remote client, or locally on the host node. The databases are the same, as
is the underlying data.
John
"Peter Yang [MSFT]" wrote:
> Hello John,
> I understand that you tried to use "alter index ...rebuild all" statement
> to some indexes, and its fragment is not changed. Also, you saw performanc
e
> degration after database migration to 2005 64 bit version from SQL 2000.
> You encountered timout errors less than 120s from clients though connectio
n
> string specifies 120s. If I'm off base, please correct me.
> Did you use sys.dm_db_index_physical_stats or dbcc showcontig to get the
> fragment information? Based on my experience, if a table does not include
> clustered index, it may have large logical fragment and low density.
> However, this does not necessarily indicate the tables/indexes are not
> efficient for all queries. Generally, rebuild index for this situation doe
s
> not change the logical fragment value. You may consider use a different
> fillfactor but I don't think this may be related to the performance issue
> you encountered.
> Also, does the issue occurs on some specific queries? Does 2 servers have
> the same load? Did you see any bottleneck in memory/IO/CPU? The whitepaper
> of performance troubleshooting in 2005 is as following:
> Troubleshooting Performance Problems in SQL Server 2005
> http://www.microsoft.com/technet/pr...5/tsprfprb.mspx
> First, please install SP1 on the server if it is not installed since many
> known issues are addressed in sp1.
> you may want to update the statistics information by using "update
> statistics" statment with "fullscan" option to see if it does any
> difference. You may also want to change the compatability level to 80 to
> test. On the other thand, if the old server exist, you may want to compare
> the execution plan on both servers to see if there is any differences:
> HOW TO: Troubleshoot Slow-Running Queries on SQL Server 7.0 or Later
> http://support.microsoft.com/?id=243589
> Please run sp_configure on both server to see if there is any difference.
> You'd like to change "max degree of parallelism" to 1 if you have
> mulitprocessors on the server to see the result.
> As for tiemout issue, you may first check if the issue occurs on local
> console of SQL Server if possible. Also, did you set commandtimeout or
> connectiontimout? Usually commandtimeout might be cause of this issue of
> long running quries.
> http://msdn.microsoft.com/library/d...com/kb/884103/
> http://www.microsoft.com/downloads/...t.com/kb/915918
> If you have any update, please feel free to let's know. Thank you.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Community Support
> ========================================
==========
> Get notification to my posts through email? Please refer to
> l]
> ications
> <[url]http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx" target="_blank">http://msdn.microsoft.com/subscript...ps/default.aspx>.
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> <http://msdn.microsoft.com/subscript...rt/default.aspx>.
> ========================================
==========
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>|||Same execution plan?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"JT" <Jthayer@.online.nospam> wrote in message
news:E3A82D97-5063-4803-8B5E-2C1B6AD3BCCA@.microsoft.com...[vbcol=seagreen]
> UNBELIEVABLE! Last night I had a particular problem sproc running in 15
> seconds on my 2GB laptop with 64 bit CPU and SQL Server 2005 64 bit. I
> drop/created the underlying indexed views on my 4 CPU XEON 3.3Ghz with 15k
> discs DELL 6850, 15k SAN discs, separated mdfs, ldfs, and tempdb on RAID 1
or
> RAID 10 production clustered setup, and the best I can get is 45 seconds w
ith
> the same procedure. This is even after a full stats update and index
> rebuilding. What am I doing wrong? This occurs whether am I running from
a
> remote client, or locally on the host node. The databases are the same, a
s
> is the underlying data.
> --
> John
>
> "Peter Yang [MSFT]" wrote:
>|||Hi Tibor,
Approximately so, but not fully investigated as these are quite complicated
queries that go way off the page when displaying the exec plan.
One thing I am noticing as I investigate these indices...
When I use SSMS to examine the indices of this database sitting on a SQL
2000 instance, I have no options for Use RowLocks and Use Page Locks when
accessing the index (as expected). When I examine the same database after
migration to SQL 2005 (via forced restore), I see the same indices with both
of these options checked. Could it be helpful to go through and uncheck
these boxes? Is there some way to do this en masse? Thanks.
--
John
"Tibor Karaszi" wrote:
> Same execution plan?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "JT" <Jthayer@.online.nospam> wrote in message
> news:E3A82D97-5063-4803-8B5E-2C1B6AD3BCCA@.microsoft.com...
>|||The "allow row locks" and "allow page locks" option is available on earlier
versions as well (I
believe since 6.5). In 2005, you set the option using CREATE and ALTER INDEX
, in earlier versions
you set it through sp_indexoption. Default is to allow both page and row loc
ks. So I very much doubt
that this is the issue here.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"JT" <Jthayer@.online.nospam> wrote in message
news:51197459-F3F5-40BC-9A53-9AC2C3080C0D@.microsoft.com...[vbcol=seagreen]
> Hi Tibor,
> Approximately so, but not fully investigated as these are quite complicate
d
> queries that go way off the page when displaying the exec plan.
> One thing I am noticing as I investigate these indices...
> When I use SSMS to examine the indices of this database sitting on a SQL
> 2000 instance, I have no options for Use RowLocks and Use Page Locks when
> accessing the index (as expected). When I examine the same database after
> migration to SQL 2005 (via forced restore), I see the same indices with bo
th
> of these options checked. Could it be helpful to go through and uncheck
> these boxes? Is there some way to do this en masse? Thanks.
> --
> John
>
> "Tibor Karaszi" wrote:
>|||Hello John,
By default, the optioins are checked and isually it is not recommended to
uncheck "use row locks" and "use page locks" for the indexes. SQL Server
shall select row locks/page locks for the better performance for specific
queries. For example, for operations that only relates several rows, it is
not efficient to only allow page locks. However, you may try to uncheck
this to see if there is any difference.
First, as Tibor mentioned, you may compare the exectution plans of both
servers to make sure it is exact same. If it is same, you may try the
following steps to get the exact
DBCC TRACEON (8760, 8605, 8606, 8607)
SET STATISTICS PROFILE ON
SET STATISTICS TIME ON
SET STATISTICS IO ON
dbcc freeproccache
dbcc dropcleanbuffers
Go
--Exec <place your stored procedure or query here>
go
SET STATISTICS PROFILE OFF
SET STATISTICS TIME OFF
SET STATISTICS IO OFF
DBCC TRACEOFF (8760, 8605, 8606, 8607)
go
Please save the result execution plan in CSV file, and copy the io/cpu/time
information in message window to a file, and send them to me at
petery@.microsoft.com.
In addtion, I'd like to know if the cluster server is a production server
under heavy load. You may use perfmon to check if there is any memory/iO
pressure on the server. Usually on a heavy load server, it is possible that
a query might be slower than a server without other loads.
http://www.extremeexperts.com/SQL/A...QLCounters.aspx
If query execution plan is different, it might be related to the following
- The metadata of the tables used in the query (columns, indexes,
constraints, indexed views, etc)
- The size of the tables and other physical structures (number of rows,
pages)
- statistics (created at some point in time in the past over the data in
the tables)
- The MAXDOP setting
- The amount of memory on the machine
- Session settings (ANSI_NULLs, etc)
- Difference in server engine
You may want to check above to see if there is any difference. If the query
is related to index view, you may want to tempoarily drop the view on both
servers to test the situation.
If you have any update, please feel free to let's know. Thank you.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============|||Hi John,
I've also experienced the drop in performance when going from SQL 2000 32
Bit to SQL 2005 64 Bit. After a lot of tuning I got it back to the same
performance as in SQL 2000, but this includes rewriting a lot of queries. It
seems that the query optimizer is working totally different than in SQL
2000. Complex derived tables and subqueries with inner subqueries are good
candidates for rewriting.
So much work to get the same speed.
Kay
Problems Defragging Indices (SQL2005 64-bit)
I have just migrated a database from SQL 2000 32 bit to SQL 2005 64 bit. I
also upgraded the compatability level to 9. Performance was immediately
horrible in terms of query execution.
Trying to solve the issue, I ran a query to retrieve indices with avgfrag >
10%. I then tried rebuilding the indices with ALTER INDEX, and ran my query
again. The avgfrag had NOT CHANGED.
What am I doing wrong?
While we're at it, I got several timeout errors from clients connecting with
ADO.NET from with the network. Their app's connection string specifies a
timeout of 120 sec, but they were timing out well before this. Just before
my database/server "upgrade", this was NOT happening. Where to best change
this to prevent further timeouts until I can get my indices and stats in
better shape?
Thanks.
--
JohnHi John
Have you checked local connectivity and connectivity from (say) query
analyser to the new server? Is remote access enabled?
When migrating did you trasfer logins/users correctly, do you have orphaned
users? Have you tried scripting/recreating the indexes, I would also consider
doing this for all views/stored procedures/functions also. Make sure that you
have updated the usage and statistics as well.
John
"JT" wrote:
> Hi all,
> I have just migrated a database from SQL 2000 32 bit to SQL 2005 64 bit. I
> also upgraded the compatability level to 9. Performance was immediately
> horrible in terms of query execution.
> Trying to solve the issue, I ran a query to retrieve indices with avgfrag >
> 10%. I then tried rebuilding the indices with ALTER INDEX, and ran my query
> again. The avgfrag had NOT CHANGED.
> What am I doing wrong?
> While we're at it, I got several timeout errors from clients connecting with
> ADO.NET from with the network. Their app's connection string specifies a
> timeout of 120 sec, but they were timing out well before this. Just before
> my database/server "upgrade", this was NOT happening. Where to best change
> this to prevent further timeouts until I can get my indices and stats in
> better shape?
> Thanks.
> --
> John|||Hello John,
I understand that you tried to use "alter index ...rebuild all" statement
to some indexes, and its fragment is not changed. Also, you saw performance
degration after database migration to 2005 64 bit version from SQL 2000.
You encountered timout errors less than 120s from clients though connection
string specifies 120s. If I'm off base, please correct me.
Did you use sys.dm_db_index_physical_stats or dbcc showcontig to get the
fragment information? Based on my experience, if a table does not include
clustered index, it may have large logical fragment and low density.
However, this does not necessarily indicate the tables/indexes are not
efficient for all queries. Generally, rebuild index for this situation does
not change the logical fragment value. You may consider use a different
fillfactor but I don't think this may be related to the performance issue
you encountered.
Also, does the issue occurs on some specific queries? Does 2 servers have
the same load? Did you see any bottleneck in memory/IO/CPU? The whitepaper
of performance troubleshooting in 2005 is as following:
Troubleshooting Performance Problems in SQL Server 2005
http://www.microsoft.com/technet/prodtechnol/sql/2005/tsprfprb.mspx
First, please install SP1 on the server if it is not installed since many
known issues are addressed in sp1.
you may want to update the statistics information by using "update
statistics" statment with "fullscan" option to see if it does any
difference. You may also want to change the compatability level to 80 to
test. On the other thand, if the old server exist, you may want to compare
the execution plan on both servers to see if there is any differences:
HOW TO: Troubleshoot Slow-Running Queries on SQL Server 7.0 or Later
http://support.microsoft.com/?id=243589
Please run sp_configure on both server to see if there is any difference.
You'd like to change "max degree of parallelism" to 1 if you have
mulitprocessors on the server to see the result.
As for tiemout issue, you may first check if the issue occurs on local
console of SQL Server if possible. Also, did you set commandtimeout or
connectiontimout? Usually commandtimeout might be cause of this issue of
long running quries.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
mdprocommandtimeout.asp
To isolate the client/server issue, you may want to install latest mdac and
sql native client on different machine, and make sure the issue occurs on
different clients
How to obtain the latest MDAC 2.8 service pack
http://support.microsoft.com/kb/884103/
http://www.microsoft.com/downloads/details.aspx?familyid=DF0BA5AA-B4BD-4705-
AA0A-B477BA72A9CB&displaylang=en
If you isolate this to be a server side issue, you may want to check if you
encounter the following known issue and get fix from it to see if you
encoutnered the issue.
FIX: The internal deadlock monitor may not detect a deadlock between two or
more sessions in SQL Server 2005
http://support.microsoft.com/kb/915918
If you have any update, please feel free to let's know. Thank you.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Community Support
==================================================Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications
<http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx>.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
<http://msdn.microsoft.com/subscriptions/support/default.aspx>.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Thank you John and Peter. The problem seems to be isolated to several
queries that rely on Indexed Views for their execution plan. The indices on
these Indexed Views really seem to be the problem. I was able to make quite
a bit of headway by disposing of several of the indices in these views, and
taking advantage of the new INCLUDE feature. Things still do not run as fast
(about 50% SLOWER) as they did on SQL 2000 32 bit, but at least I am no
longer getting the timeouts.
--
John
"Peter Yang [MSFT]" wrote:
> Hello John,
> I understand that you tried to use "alter index ...rebuild all" statement
> to some indexes, and its fragment is not changed. Also, you saw performance
> degration after database migration to 2005 64 bit version from SQL 2000.
> You encountered timout errors less than 120s from clients though connection
> string specifies 120s. If I'm off base, please correct me.
> Did you use sys.dm_db_index_physical_stats or dbcc showcontig to get the
> fragment information? Based on my experience, if a table does not include
> clustered index, it may have large logical fragment and low density.
> However, this does not necessarily indicate the tables/indexes are not
> efficient for all queries. Generally, rebuild index for this situation does
> not change the logical fragment value. You may consider use a different
> fillfactor but I don't think this may be related to the performance issue
> you encountered.
> Also, does the issue occurs on some specific queries? Does 2 servers have
> the same load? Did you see any bottleneck in memory/IO/CPU? The whitepaper
> of performance troubleshooting in 2005 is as following:
> Troubleshooting Performance Problems in SQL Server 2005
> http://www.microsoft.com/technet/prodtechnol/sql/2005/tsprfprb.mspx
> First, please install SP1 on the server if it is not installed since many
> known issues are addressed in sp1.
> you may want to update the statistics information by using "update
> statistics" statment with "fullscan" option to see if it does any
> difference. You may also want to change the compatability level to 80 to
> test. On the other thand, if the old server exist, you may want to compare
> the execution plan on both servers to see if there is any differences:
> HOW TO: Troubleshoot Slow-Running Queries on SQL Server 7.0 or Later
> http://support.microsoft.com/?id=243589
> Please run sp_configure on both server to see if there is any difference.
> You'd like to change "max degree of parallelism" to 1 if you have
> mulitprocessors on the server to see the result.
> As for tiemout issue, you may first check if the issue occurs on local
> console of SQL Server if possible. Also, did you set commandtimeout or
> connectiontimout? Usually commandtimeout might be cause of this issue of
> long running quries.
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
> mdprocommandtimeout.asp
> To isolate the client/server issue, you may want to install latest mdac and
> sql native client on different machine, and make sure the issue occurs on
> different clients
> How to obtain the latest MDAC 2.8 service pack
> http://support.microsoft.com/kb/884103/
> http://www.microsoft.com/downloads/details.aspx?familyid=DF0BA5AA-B4BD-4705-
> AA0A-B477BA72A9CB&displaylang=en
> If you isolate this to be a server side issue, you may want to check if you
> encounter the following known issue and get fix from it to see if you
> encoutnered the issue.
> FIX: The internal deadlock monitor may not detect a deadlock between two or
> more sessions in SQL Server 2005
> http://support.microsoft.com/kb/915918
> If you have any update, please feel free to let's know. Thank you.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Community Support
> ==================================================> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications
> <http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx>.
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> <http://msdn.microsoft.com/subscriptions/support/default.aspx>.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||UNBELIEVABLE! Last night I had a particular problem sproc running in 15
seconds on my 2GB laptop with 64 bit CPU and SQL Server 2005 64 bit. I
drop/created the underlying indexed views on my 4 CPU XEON 3.3Ghz with 15k
discs DELL 6850, 15k SAN discs, separated mdfs, ldfs, and tempdb on RAID 1 or
RAID 10 production clustered setup, and the best I can get is 45 seconds with
the same procedure. This is even after a full stats update and index
rebuilding. What am I doing wrong? This occurs whether am I running from a
remote client, or locally on the host node. The databases are the same, as
is the underlying data.
--
John
"Peter Yang [MSFT]" wrote:
> Hello John,
> I understand that you tried to use "alter index ...rebuild all" statement
> to some indexes, and its fragment is not changed. Also, you saw performance
> degration after database migration to 2005 64 bit version from SQL 2000.
> You encountered timout errors less than 120s from clients though connection
> string specifies 120s. If I'm off base, please correct me.
> Did you use sys.dm_db_index_physical_stats or dbcc showcontig to get the
> fragment information? Based on my experience, if a table does not include
> clustered index, it may have large logical fragment and low density.
> However, this does not necessarily indicate the tables/indexes are not
> efficient for all queries. Generally, rebuild index for this situation does
> not change the logical fragment value. You may consider use a different
> fillfactor but I don't think this may be related to the performance issue
> you encountered.
> Also, does the issue occurs on some specific queries? Does 2 servers have
> the same load? Did you see any bottleneck in memory/IO/CPU? The whitepaper
> of performance troubleshooting in 2005 is as following:
> Troubleshooting Performance Problems in SQL Server 2005
> http://www.microsoft.com/technet/prodtechnol/sql/2005/tsprfprb.mspx
> First, please install SP1 on the server if it is not installed since many
> known issues are addressed in sp1.
> you may want to update the statistics information by using "update
> statistics" statment with "fullscan" option to see if it does any
> difference. You may also want to change the compatability level to 80 to
> test. On the other thand, if the old server exist, you may want to compare
> the execution plan on both servers to see if there is any differences:
> HOW TO: Troubleshoot Slow-Running Queries on SQL Server 7.0 or Later
> http://support.microsoft.com/?id=243589
> Please run sp_configure on both server to see if there is any difference.
> You'd like to change "max degree of parallelism" to 1 if you have
> mulitprocessors on the server to see the result.
> As for tiemout issue, you may first check if the issue occurs on local
> console of SQL Server if possible. Also, did you set commandtimeout or
> connectiontimout? Usually commandtimeout might be cause of this issue of
> long running quries.
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
> mdprocommandtimeout.asp
> To isolate the client/server issue, you may want to install latest mdac and
> sql native client on different machine, and make sure the issue occurs on
> different clients
> How to obtain the latest MDAC 2.8 service pack
> http://support.microsoft.com/kb/884103/
> http://www.microsoft.com/downloads/details.aspx?familyid=DF0BA5AA-B4BD-4705-
> AA0A-B477BA72A9CB&displaylang=en
> If you isolate this to be a server side issue, you may want to check if you
> encounter the following known issue and get fix from it to see if you
> encoutnered the issue.
> FIX: The internal deadlock monitor may not detect a deadlock between two or
> more sessions in SQL Server 2005
> http://support.microsoft.com/kb/915918
> If you have any update, please feel free to let's know. Thank you.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Community Support
> ==================================================> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications
> <http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx>.
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> <http://msdn.microsoft.com/subscriptions/support/default.aspx>.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||Same execution plan?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"JT" <Jthayer@.online.nospam> wrote in message
news:E3A82D97-5063-4803-8B5E-2C1B6AD3BCCA@.microsoft.com...
> UNBELIEVABLE! Last night I had a particular problem sproc running in 15
> seconds on my 2GB laptop with 64 bit CPU and SQL Server 2005 64 bit. I
> drop/created the underlying indexed views on my 4 CPU XEON 3.3Ghz with 15k
> discs DELL 6850, 15k SAN discs, separated mdfs, ldfs, and tempdb on RAID 1 or
> RAID 10 production clustered setup, and the best I can get is 45 seconds with
> the same procedure. This is even after a full stats update and index
> rebuilding. What am I doing wrong? This occurs whether am I running from a
> remote client, or locally on the host node. The databases are the same, as
> is the underlying data.
> --
> John
>
> "Peter Yang [MSFT]" wrote:
>> Hello John,
>> I understand that you tried to use "alter index ...rebuild all" statement
>> to some indexes, and its fragment is not changed. Also, you saw performance
>> degration after database migration to 2005 64 bit version from SQL 2000.
>> You encountered timout errors less than 120s from clients though connection
>> string specifies 120s. If I'm off base, please correct me.
>> Did you use sys.dm_db_index_physical_stats or dbcc showcontig to get the
>> fragment information? Based on my experience, if a table does not include
>> clustered index, it may have large logical fragment and low density.
>> However, this does not necessarily indicate the tables/indexes are not
>> efficient for all queries. Generally, rebuild index for this situation does
>> not change the logical fragment value. You may consider use a different
>> fillfactor but I don't think this may be related to the performance issue
>> you encountered.
>> Also, does the issue occurs on some specific queries? Does 2 servers have
>> the same load? Did you see any bottleneck in memory/IO/CPU? The whitepaper
>> of performance troubleshooting in 2005 is as following:
>> Troubleshooting Performance Problems in SQL Server 2005
>> http://www.microsoft.com/technet/prodtechnol/sql/2005/tsprfprb.mspx
>> First, please install SP1 on the server if it is not installed since many
>> known issues are addressed in sp1.
>> you may want to update the statistics information by using "update
>> statistics" statment with "fullscan" option to see if it does any
>> difference. You may also want to change the compatability level to 80 to
>> test. On the other thand, if the old server exist, you may want to compare
>> the execution plan on both servers to see if there is any differences:
>> HOW TO: Troubleshoot Slow-Running Queries on SQL Server 7.0 or Later
>> http://support.microsoft.com/?id=243589
>> Please run sp_configure on both server to see if there is any difference.
>> You'd like to change "max degree of parallelism" to 1 if you have
>> mulitprocessors on the server to see the result.
>> As for tiemout issue, you may first check if the issue occurs on local
>> console of SQL Server if possible. Also, did you set commandtimeout or
>> connectiontimout? Usually commandtimeout might be cause of this issue of
>> long running quries.
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
>> mdprocommandtimeout.asp
>> To isolate the client/server issue, you may want to install latest mdac and
>> sql native client on different machine, and make sure the issue occurs on
>> different clients
>> How to obtain the latest MDAC 2.8 service pack
>> http://support.microsoft.com/kb/884103/
>> http://www.microsoft.com/downloads/details.aspx?familyid=DF0BA5AA-B4BD-4705-
>> AA0A-B477BA72A9CB&displaylang=en
>> If you isolate this to be a server side issue, you may want to check if you
>> encounter the following known issue and get fix from it to see if you
>> encoutnered the issue.
>> FIX: The internal deadlock monitor may not detect a deadlock between two or
>> more sessions in SQL Server 2005
>> http://support.microsoft.com/kb/915918
>> If you have any update, please feel free to let's know. Thank you.
>> Best Regards,
>> Peter Yang
>> MCSE2000/2003, MCSA, MCDBA
>> Microsoft Online Community Support
>> ==================================================>> Get notification to my posts through email? Please refer to
>> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
>> ications
>> <http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx>.
>> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
>> where an initial response from the community or a Microsoft Support
>> Engineer within 1 business day is acceptable. Please note that each follow
>> up response may take approximately 2 business days as the support
>> professional working with you may need further investigation to reach the
>> most efficient resolution. The offering is not appropriate for situations
>> that require urgent, real-time or phone-based interactions or complex
>> project analysis and dump analysis issues. Issues of this nature are best
>> handled working with a dedicated Microsoft Support Engineer by contacting
>> Microsoft Customer Support Services (CSS) at
>> <http://msdn.microsoft.com/subscriptions/support/default.aspx>.
>> ==================================================>> This posting is provided "AS IS" with no warranties, and confers no rights.
>>|||Hi Tibor,
Approximately so, but not fully investigated as these are quite complicated
queries that go way off the page when displaying the exec plan.
One thing I am noticing as I investigate these indices...
When I use SSMS to examine the indices of this database sitting on a SQL
2000 instance, I have no options for Use RowLocks and Use Page Locks when
accessing the index (as expected). When I examine the same database after
migration to SQL 2005 (via forced restore), I see the same indices with both
of these options checked. Could it be helpful to go through and uncheck
these boxes? Is there some way to do this en masse? Thanks.
--
John
"Tibor Karaszi" wrote:
> Same execution plan?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "JT" <Jthayer@.online.nospam> wrote in message
> news:E3A82D97-5063-4803-8B5E-2C1B6AD3BCCA@.microsoft.com...
> > UNBELIEVABLE! Last night I had a particular problem sproc running in 15
> > seconds on my 2GB laptop with 64 bit CPU and SQL Server 2005 64 bit. I
> > drop/created the underlying indexed views on my 4 CPU XEON 3.3Ghz with 15k
> > discs DELL 6850, 15k SAN discs, separated mdfs, ldfs, and tempdb on RAID 1 or
> > RAID 10 production clustered setup, and the best I can get is 45 seconds with
> > the same procedure. This is even after a full stats update and index
> > rebuilding. What am I doing wrong? This occurs whether am I running from a
> > remote client, or locally on the host node. The databases are the same, as
> > is the underlying data.
> >
> > --
> > John
> >
> >
> > "Peter Yang [MSFT]" wrote:
> >
> >> Hello John,
> >>
> >> I understand that you tried to use "alter index ...rebuild all" statement
> >> to some indexes, and its fragment is not changed. Also, you saw performance
> >> degration after database migration to 2005 64 bit version from SQL 2000.
> >> You encountered timout errors less than 120s from clients though connection
> >> string specifies 120s. If I'm off base, please correct me.
> >>
> >> Did you use sys.dm_db_index_physical_stats or dbcc showcontig to get the
> >> fragment information? Based on my experience, if a table does not include
> >> clustered index, it may have large logical fragment and low density.
> >> However, this does not necessarily indicate the tables/indexes are not
> >> efficient for all queries. Generally, rebuild index for this situation does
> >> not change the logical fragment value. You may consider use a different
> >> fillfactor but I don't think this may be related to the performance issue
> >> you encountered.
> >>
> >> Also, does the issue occurs on some specific queries? Does 2 servers have
> >> the same load? Did you see any bottleneck in memory/IO/CPU? The whitepaper
> >> of performance troubleshooting in 2005 is as following:
> >>
> >> Troubleshooting Performance Problems in SQL Server 2005
> >> http://www.microsoft.com/technet/prodtechnol/sql/2005/tsprfprb.mspx
> >>
> >> First, please install SP1 on the server if it is not installed since many
> >> known issues are addressed in sp1.
> >>
> >> you may want to update the statistics information by using "update
> >> statistics" statment with "fullscan" option to see if it does any
> >> difference. You may also want to change the compatability level to 80 to
> >> test. On the other thand, if the old server exist, you may want to compare
> >> the execution plan on both servers to see if there is any differences:
> >>
> >> HOW TO: Troubleshoot Slow-Running Queries on SQL Server 7.0 or Later
> >> http://support.microsoft.com/?id=243589
> >>
> >> Please run sp_configure on both server to see if there is any difference.
> >> You'd like to change "max degree of parallelism" to 1 if you have
> >> mulitprocessors on the server to see the result.
> >>
> >> As for tiemout issue, you may first check if the issue occurs on local
> >> console of SQL Server if possible. Also, did you set commandtimeout or
> >> connectiontimout? Usually commandtimeout might be cause of this issue of
> >> long running quries.
> >>
> >> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
> >> mdprocommandtimeout.asp
> >>
> >> To isolate the client/server issue, you may want to install latest mdac and
> >> sql native client on different machine, and make sure the issue occurs on
> >> different clients
> >>
> >> How to obtain the latest MDAC 2.8 service pack
> >> http://support.microsoft.com/kb/884103/
> >>
> >> http://www.microsoft.com/downloads/details.aspx?familyid=DF0BA5AA-B4BD-4705-
> >> AA0A-B477BA72A9CB&displaylang=en
> >>
> >> If you isolate this to be a server side issue, you may want to check if you
> >> encounter the following known issue and get fix from it to see if you
> >> encoutnered the issue.
> >>
> >> FIX: The internal deadlock monitor may not detect a deadlock between two or
> >> more sessions in SQL Server 2005
> >> http://support.microsoft.com/kb/915918
> >>
> >> If you have any update, please feel free to let's know. Thank you.
> >>
> >> Best Regards,
> >>
> >> Peter Yang
> >> MCSE2000/2003, MCSA, MCDBA
> >> Microsoft Online Community Support
> >> ==================================================> >> Get notification to my posts through email? Please refer to
> >> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> >> ications
> >> <http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx>.
> >> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> >> where an initial response from the community or a Microsoft Support
> >> Engineer within 1 business day is acceptable. Please note that each follow
> >> up response may take approximately 2 business days as the support
> >> professional working with you may need further investigation to reach the
> >> most efficient resolution. The offering is not appropriate for situations
> >> that require urgent, real-time or phone-based interactions or complex
> >> project analysis and dump analysis issues. Issues of this nature are best
> >> handled working with a dedicated Microsoft Support Engineer by contacting
> >> Microsoft Customer Support Services (CSS) at
> >> <http://msdn.microsoft.com/subscriptions/support/default.aspx>.
> >> ==================================================> >> This posting is provided "AS IS" with no warranties, and confers no rights.
> >>
> >>
>|||The "allow row locks" and "allow page locks" option is available on earlier versions as well (I
believe since 6.5). In 2005, you set the option using CREATE and ALTER INDEX, in earlier versions
you set it through sp_indexoption. Default is to allow both page and row locks. So I very much doubt
that this is the issue here.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"JT" <Jthayer@.online.nospam> wrote in message
news:51197459-F3F5-40BC-9A53-9AC2C3080C0D@.microsoft.com...
> Hi Tibor,
> Approximately so, but not fully investigated as these are quite complicated
> queries that go way off the page when displaying the exec plan.
> One thing I am noticing as I investigate these indices...
> When I use SSMS to examine the indices of this database sitting on a SQL
> 2000 instance, I have no options for Use RowLocks and Use Page Locks when
> accessing the index (as expected). When I examine the same database after
> migration to SQL 2005 (via forced restore), I see the same indices with both
> of these options checked. Could it be helpful to go through and uncheck
> these boxes? Is there some way to do this en masse? Thanks.
> --
> John
>
> "Tibor Karaszi" wrote:
>> Same execution plan?
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "JT" <Jthayer@.online.nospam> wrote in message
>> news:E3A82D97-5063-4803-8B5E-2C1B6AD3BCCA@.microsoft.com...
>> > UNBELIEVABLE! Last night I had a particular problem sproc running in 15
>> > seconds on my 2GB laptop with 64 bit CPU and SQL Server 2005 64 bit. I
>> > drop/created the underlying indexed views on my 4 CPU XEON 3.3Ghz with 15k
>> > discs DELL 6850, 15k SAN discs, separated mdfs, ldfs, and tempdb on RAID 1 or
>> > RAID 10 production clustered setup, and the best I can get is 45 seconds with
>> > the same procedure. This is even after a full stats update and index
>> > rebuilding. What am I doing wrong? This occurs whether am I running from a
>> > remote client, or locally on the host node. The databases are the same, as
>> > is the underlying data.
>> >
>> > --
>> > John
>> >
>> >
>> > "Peter Yang [MSFT]" wrote:
>> >
>> >> Hello John,
>> >>
>> >> I understand that you tried to use "alter index ...rebuild all" statement
>> >> to some indexes, and its fragment is not changed. Also, you saw performance
>> >> degration after database migration to 2005 64 bit version from SQL 2000.
>> >> You encountered timout errors less than 120s from clients though connection
>> >> string specifies 120s. If I'm off base, please correct me.
>> >>
>> >> Did you use sys.dm_db_index_physical_stats or dbcc showcontig to get the
>> >> fragment information? Based on my experience, if a table does not include
>> >> clustered index, it may have large logical fragment and low density.
>> >> However, this does not necessarily indicate the tables/indexes are not
>> >> efficient for all queries. Generally, rebuild index for this situation does
>> >> not change the logical fragment value. You may consider use a different
>> >> fillfactor but I don't think this may be related to the performance issue
>> >> you encountered.
>> >>
>> >> Also, does the issue occurs on some specific queries? Does 2 servers have
>> >> the same load? Did you see any bottleneck in memory/IO/CPU? The whitepaper
>> >> of performance troubleshooting in 2005 is as following:
>> >>
>> >> Troubleshooting Performance Problems in SQL Server 2005
>> >> http://www.microsoft.com/technet/prodtechnol/sql/2005/tsprfprb.mspx
>> >>
>> >> First, please install SP1 on the server if it is not installed since many
>> >> known issues are addressed in sp1.
>> >>
>> >> you may want to update the statistics information by using "update
>> >> statistics" statment with "fullscan" option to see if it does any
>> >> difference. You may also want to change the compatability level to 80 to
>> >> test. On the other thand, if the old server exist, you may want to compare
>> >> the execution plan on both servers to see if there is any differences:
>> >>
>> >> HOW TO: Troubleshoot Slow-Running Queries on SQL Server 7.0 or Later
>> >> http://support.microsoft.com/?id=243589
>> >>
>> >> Please run sp_configure on both server to see if there is any difference.
>> >> You'd like to change "max degree of parallelism" to 1 if you have
>> >> mulitprocessors on the server to see the result.
>> >>
>> >> As for tiemout issue, you may first check if the issue occurs on local
>> >> console of SQL Server if possible. Also, did you set commandtimeout or
>> >> connectiontimout? Usually commandtimeout might be cause of this issue of
>> >> long running quries.
>> >>
>> >> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
>> >> mdprocommandtimeout.asp
>> >>
>> >> To isolate the client/server issue, you may want to install latest mdac and
>> >> sql native client on different machine, and make sure the issue occurs on
>> >> different clients
>> >>
>> >> How to obtain the latest MDAC 2.8 service pack
>> >> http://support.microsoft.com/kb/884103/
>> >>
>> >> http://www.microsoft.com/downloads/details.aspx?familyid=DF0BA5AA-B4BD-4705-
>> >> AA0A-B477BA72A9CB&displaylang=en
>> >>
>> >> If you isolate this to be a server side issue, you may want to check if you
>> >> encounter the following known issue and get fix from it to see if you
>> >> encoutnered the issue.
>> >>
>> >> FIX: The internal deadlock monitor may not detect a deadlock between two or
>> >> more sessions in SQL Server 2005
>> >> http://support.microsoft.com/kb/915918
>> >>
>> >> If you have any update, please feel free to let's know. Thank you.
>> >>
>> >> Best Regards,
>> >>
>> >> Peter Yang
>> >> MCSE2000/2003, MCSA, MCDBA
>> >> Microsoft Online Community Support
>> >> ==================================================>> >> Get notification to my posts through email? Please refer to
>> >> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
>> >> ications
>> >> <http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx>.
>> >> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
>> >> where an initial response from the community or a Microsoft Support
>> >> Engineer within 1 business day is acceptable. Please note that each follow
>> >> up response may take approximately 2 business days as the support
>> >> professional working with you may need further investigation to reach the
>> >> most efficient resolution. The offering is not appropriate for situations
>> >> that require urgent, real-time or phone-based interactions or complex
>> >> project analysis and dump analysis issues. Issues of this nature are best
>> >> handled working with a dedicated Microsoft Support Engineer by contacting
>> >> Microsoft Customer Support Services (CSS) at
>> >> <http://msdn.microsoft.com/subscriptions/support/default.aspx>.
>> >> ==================================================>> >> This posting is provided "AS IS" with no warranties, and confers no rights.
>> >>
>> >>
>>|||Hello John,
By default, the optioins are checked and isually it is not recommended to
uncheck "use row locks" and "use page locks" for the indexes. SQL Server
shall select row locks/page locks for the better performance for specific
queries. For example, for operations that only relates several rows, it is
not efficient to only allow page locks. However, you may try to uncheck
this to see if there is any difference.
First, as Tibor mentioned, you may compare the exectution plans of both
servers to make sure it is exact same. If it is same, you may try the
following steps to get the exact
DBCC TRACEON (8760, 8605, 8606, 8607)
SET STATISTICS PROFILE ON
SET STATISTICS TIME ON
SET STATISTICS IO ON
dbcc freeproccache
dbcc dropcleanbuffers
Go
--Exec <place your stored procedure or query here>
go
SET STATISTICS PROFILE OFF
SET STATISTICS TIME OFF
SET STATISTICS IO OFF
DBCC TRACEOFF (8760, 8605, 8606, 8607)
go
Please save the result execution plan in CSV file, and copy the io/cpu/time
information in message window to a file, and send them to me at
petery@.microsoft.com.
In addtion, I'd like to know if the cluster server is a production server
under heavy load. You may use perfmon to check if there is any memory/iO
pressure on the server. Usually on a heavy load server, it is possible that
a query might be slower than a server without other loads.
http://www.extremeexperts.com/SQL/Articles/SQLCounters.aspx
If query execution plan is different, it might be related to the following
- The metadata of the tables used in the query (columns, indexes,
constraints, indexed views, etc)
- The size of the tables and other physical structures (number of rows,
pages)
- statistics (created at some point in time in the past over the data in
the tables)
- The MAXDOP setting
- The amount of memory on the machine
- Session settings (ANSI_NULLs, etc)
- Difference in server engine
You may want to check above to see if there is any difference. If the query
is related to index view, you may want to tempoarily drop the view on both
servers to test the situation.
If you have any update, please feel free to let's know. Thank you.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================|||Hi John,
I've also experienced the drop in performance when going from SQL 2000 32
Bit to SQL 2005 64 Bit. After a lot of tuning I got it back to the same
performance as in SQL 2000, but this includes rewriting a lot of queries. It
seems that the query optimizer is working totally different than in SQL
2000. Complex derived tables and subqueries with inner subqueries are good
candidates for rewriting.
So much work to get the same speed.
Kay|||Peter - thanks for your most generous offer to take on looking over the
execution plans. For now, I will spare you of this. This weekend, I plan to
devote some serious time to optimizing and restructuring several queries. If
I do not succeed, I will then take you up on your offer. Thanks for being
such an excellent resource!
--
John
"Peter Yang [MSFT]" wrote:
> Hello John,
> By default, the optioins are checked and isually it is not recommended to
> uncheck "use row locks" and "use page locks" for the indexes. SQL Server
> shall select row locks/page locks for the better performance for specific
> queries. For example, for operations that only relates several rows, it is
> not efficient to only allow page locks. However, you may try to uncheck
> this to see if there is any difference.
> First, as Tibor mentioned, you may compare the exectution plans of both
> servers to make sure it is exact same. If it is same, you may try the
> following steps to get the exact
>
> DBCC TRACEON (8760, 8605, 8606, 8607)
> SET STATISTICS PROFILE ON
> SET STATISTICS TIME ON
> SET STATISTICS IO ON
> dbcc freeproccache
> dbcc dropcleanbuffers
> Go
> --Exec <place your stored procedure or query here>
> go
> SET STATISTICS PROFILE OFF
> SET STATISTICS TIME OFF
> SET STATISTICS IO OFF
> DBCC TRACEOFF (8760, 8605, 8606, 8607)
> go
>
> Please save the result execution plan in CSV file, and copy the io/cpu/time
> information in message window to a file, and send them to me at
> petery@.microsoft.com.
> In addtion, I'd like to know if the cluster server is a production server
> under heavy load. You may use perfmon to check if there is any memory/iO
> pressure on the server. Usually on a heavy load server, it is possible that
> a query might be slower than a server without other loads.
> http://www.extremeexperts.com/SQL/Articles/SQLCounters.aspx
> If query execution plan is different, it might be related to the following
> - The metadata of the tables used in the query (columns, indexes,
> constraints, indexed views, etc)
> - The size of the tables and other physical structures (number of rows,
> pages)
> - statistics (created at some point in time in the past over the data in
> the tables)
> - The MAXDOP setting
> - The amount of memory on the machine
> - Session settings (ANSI_NULLs, etc)
> - Difference in server engine
> You may want to check above to see if there is any difference. If the query
> is related to index view, you may want to tempoarily drop the view on both
> servers to test the situation.
> If you have any update, please feel free to let's know. Thank you.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Partner Support
>
> =====================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
> ======================================================>
>|||Hello John,
I'm still interested in this issue. Did you try to solve the issue in the
weekend? If the issue persists, please get the informaiton I mentioend so
that we may further troubleshoot the issue. If you have other priorites,
please also let's know and we may work on the problem a little alter. Thank
you.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================|||Hi Peter,
I have largely resolved the issue. The steps I took included
1. greatly expanding the resources of tempdb, giving it eight equally sized
200MB mdf/ndf files to work with on a RAID 1/0 LUN.
2. Using NOEXPAND to force the optimizer to choose indexed views. (This
made a HUGE difference - like 1000% performance gains.) You can see my post
on this in SQL Server.Programming under Indexed View Issue, dated 11/22/2006).
3. Identifying an error in the 2005 scripting wizard which has been sending
me on a tail-chase regarding indices on Indexed Views. You can see my post
on this at SQL Server.Server under WARNING-SCRIPTING ENGINE UNRELIABLE, dated
11/26/2006.
4. Reading Itzak Ben-Gan's two books and doing a lot of optimization work.
Bottom line, I had a particularly gruesome query that ran in 7 seconds with
SQL 2000, and then went up to 25 seconds in SQL 2005 x64. I got it down to
1.7 seconds now, still using SQL 2005 x64. This is just one of many examples.
Thanks for your help.
John
"Peter Yang [MSFT]" wrote:
> Hello John,
> I'm still interested in this issue. Did you try to solve the issue in the
> weekend? If the issue persists, please get the informaiton I mentioend so
> that we may further troubleshoot the issue. If you have other priorites,
> please also let's know and we may work on the problem a little alter. Thank
> you.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Partner Support
>
> =====================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
> ======================================================>
>|||Hi John
Thanks for the feed back,
Links to the previous threads:
2. Indexed View Issue http://tinyurl.com/yj4qvn
3. WARNING-SCRIPTING ENGINE UNRELIABLE - http://tinyurl.com/wu6aq
IMO Itzik's books in the Inside SQL Server 2005 series are must buys for any
Programmer/DBA using SQL Server 2005.
John
"JT" wrote:
> Hi Peter,
> I have largely resolved the issue. The steps I took included
> 1. greatly expanding the resources of tempdb, giving it eight equally sized
> 200MB mdf/ndf files to work with on a RAID 1/0 LUN.
> 2. Using NOEXPAND to force the optimizer to choose indexed views. (This
> made a HUGE difference - like 1000% performance gains.) You can see my post
> on this in SQL Server.Programming under Indexed View Issue, dated 11/22/2006).
> 3. Identifying an error in the 2005 scripting wizard which has been sending
> me on a tail-chase regarding indices on Indexed Views. You can see my post
> on this at SQL Server.Server under WARNING-SCRIPTING ENGINE UNRELIABLE, dated
> 11/26/2006.
> 4. Reading Itzak Ben-Gan's two books and doing a lot of optimization work.
> Bottom line, I had a particularly gruesome query that ran in 7 seconds with
> SQL 2000, and then went up to 25 seconds in SQL 2005 x64. I got it down to
> 1.7 seconds now, still using SQL 2005 x64. This is just one of many examples.
> Thanks for your help.
>
> --
> John
>
> "Peter Yang [MSFT]" wrote:
> > Hello John,
> >
> > I'm still interested in this issue. Did you try to solve the issue in the
> > weekend? If the issue persists, please get the informaiton I mentioend so
> > that we may further troubleshoot the issue. If you have other priorites,
> > please also let's know and we may work on the problem a little alter. Thank
> > you.
> >
> > Best Regards,
> >
> > Peter Yang
> > MCSE2000/2003, MCSA, MCDBA
> > Microsoft Online Partner Support
> >
> >
> > =====================================================> >
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> > ======================================================> >
> >
> >|||Hello John,
Thank you for sharing your experience on this issue and this shall
defenitely benefit the community. :-)
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
Saturday, February 25, 2012
Problem with View migrated from SQL Server 2000 into 2005
We are in the process of migrating from SQL Server 2000 to 2005. We encountered a problem with one of our web applications (ASP) when attached to the new 2005 database. We do not get this error when the application is attached to the 2000 database.
During execution of the following code:
--
sub OpenRS_TicketDetails(iTicketID)
strSQL="SELECT * from vwexTicketDetails WHERE TicketID =" & iTicketID
rs.open strSQL, cnReadWrite, adOpenStatic, adLockOptimistic
end sub
We encountered the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e23'
Row handle referred to a deleted row or a row marked for deletion.
The following is the select statement related to the view:
SELECT T.TicketID, T.TicketDate, T.Problem, T.Technician_Assigned, T.Closed_Date, T.PersonID, T.SiteId, T.ProgramId, T.StatusId, T.PriorityId, T.CategoryId,
CMT.Comment, RTRIM(P.LastName) + ', ' + RTRIM(P.FirstName) AS FullName, P.Phone, P.WorkLocation, CT.CategoryName AS Category,
PR.priorityDesc AS Priority, ST.statusDesc AS Status
FROM dbo.dtTickets AS T LEFT OUTER JOIN
dbo.dtComments AS CMT ON T.TicketID = CMT.TicketID LEFT OUTER JOIN
DIVCommon.dbo.dtPersonnel AS P ON T.PersonID = P.PersonID INNER JOIN
dbo.vtCategory AS CT ON T.CategoryId = CT.CategoryID INNER JOIN
dbo.vtPriority AS PR ON T.PriorityId = PR.priorityId INNER JOIN
dbo.vtStatus AS ST ON T.StatusId = ST.statusId
We tracked the problem to the dtComments table and were able to come up with a workaround to our problem. When we added a primary key to the dtComments table, the application ran fine.
CREATE TABLE [dbo].[dtComments](
[CommentId] [int] IDENTITY(1,1) NOT NULL,
[TicketID] [int] NULL,
[Comment] [varchar](8000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LastModUser] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LastModDate] [datetime] NULL)
Can someone explain to me why we are experiencing this problem in the 2005 environment and if there is a better solution. Please let me know if you need additional information about this situation.
Thanks, Doug
I can't say why it is a problem in 2005 rather than 2000. But I can explain why the problem, its not simple and to do with some inner workings of ADO, metadata and optimistic locking
You are specified to have a optimistic locked recordset based on a view. Firstly you shouldn't do this with views because you can end up with orphaned rows if you try and insert data.
How ADO handles the optimistic locking is it needs to know how to identify the row that is being updated and also how to identify what determines the record has changed so that it can verify the update. However your dtComments table doesn't have a PK thus the problem. ADO does try and obtain the information needed in the absence of a PK but this is what is causing the problem.
Putting a PK should be your answer, all tables should have one unless a specific reason not to.
You could also try changing it to a readonly recordset.