Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Query performance Expand / Collapse
Author
Message
Posted Sunday, December 1, 2013 9:07 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 8, 2014 11:15 PM
Points: 9, Visits: 243
Some of developers have made modifications to database structure like indexes and later observed that the performance of queries have degraded. As per the information of the developers all the changes have been reverted back but still the performance is bad.

We took the backup of the database before changes and restored on the same server. We could see the query performing well on the restored database. While observing the execution plans we see index scans ,whereas the same index structure exists on the all the tables involved.

Verified indices ,stats and have updated them as well still the issue is not resolved

Can you please suggest what other aspects to be checked. Thank you in advance for help
Post #1518701
Posted Sunday, December 1, 2013 5:17 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:32 AM
Points: 37,104, Visits: 31,658
I would first ask the Developers how they knew they rolled everything back and how they knew they didn't drop something that they didn't add.

The other thing might be that things are "stuck". In other words, maybe you need to do a DBCC FREEPROCCACHE followed by a DBCC DROPCLEANBUFFERS to get all of the stored procedures to recompile. Bear in mind that that act alone will make things run slowly at first because all of the data and procs that are normally cached will need to recache.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1518720
Posted Monday, December 2, 2013 1:51 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 8, 2014 11:15 PM
Points: 9, Visits: 243
Thank you Jeff Moden for your reply.

I have compared the indexes on the database(which was restored by using a backup before the modifications).
The index structures are same on both the databases. When I observe the execution plan I could see Index scans which were due to the absence of seek predicates.

We are using a SQL 2012 server. Any tips would be helpful. Same structure on one database is using Index seeks and on the other Index scans.

Thanks,
Raghu
Post #1518793
Posted Monday, December 2, 2013 3:12 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Sunday, September 7, 2014 11:27 PM
Points: 7,164, Visits: 13,257
Like Jeff already suggested: it might be required to recompile the code since the cached query plans might still not reflect the new index.

Jeff suggested the DBCC FREEPROCCACHE followed by a DBCC DROPCLEANBUFFERS.

That's the very first time I disagree with him (and most probably I'll be proven wrong...)

I'd rather go "step by step" and start with a single sproc that I know performs badly.
Recompile this sproc separately either by using the option WITH RECOMPILE or by running EXEC sp_recompile N'yourSchema.YourSproc' and verify this will actually help to improve performance.

Once you know that recompile is the solution you could either recompile the sprocs and queries step by step or run the DBCC FREEPROCCACHE followed by a DBCC DROPCLEANBUFFERS as suggested.





Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #1518816
Posted Monday, December 2, 2013 3:29 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 7:57 AM
Points: 43,045, Visits: 36,205
Worth noting that a restore clears the plan cache for the restored database, so plans could not have persisted from before the restore.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1518821
Posted Monday, December 2, 2013 8:45 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:32 AM
Points: 37,104, Visits: 31,658
GilaMonster (12/2/2013)
Worth noting that a restore clears the plan cache for the restored database, so plans could not have persisted from before the restore.


Absolutely understood and agreed. I was talking about the original database where they "rolled back" the changes and were still having problems. Perhaps I misunderstood what was actually done.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1518918
Posted Tuesday, December 3, 2013 6:24 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 10:38 AM
Points: 4,357, Visits: 6,192
Compare the amount of data in the tables involved. Perhaps someone did some inserts or deletes that changed estimated row counts.

Verify that the queries are EXACTLY the same, and I do mean EXACT. If views or functions are involved, verify them down to the character as well.

Verify the actual schema of all tables involved. Someone could have changed a column from a varchar(20) to an Nvarchar(20).

Check data value distributions. Someone could have updated data which caused estimated rows to vary between the two database copies.



Best,

Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru at GMail
Post #1519454
Posted Thursday, December 5, 2013 10:43 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 11:27 AM
Points: 329, Visits: 2,240
This can also be a simple issue of out of date statistics.
SQL servers build in auto update statistics (if its on in your database) does not always do the job when you want or need it for better query plans.
Is there a nightly job updating them?

Finally isolate the few queries that (likely) cause slowdown.
You might find that due to growing data volumes some specific indexes or SQL statement alterations are in order.
Always keep in mind that a database that works with small volumes can have drastically different behavior whith multiple times the data volumes.
A larger volume brings brings existing inefficiencies to light and makes them suddenly measurable/noticable.

And then one more thing. Is the load of the system increased and do you use ad-hoc queries?
You should make sure that you use parameterized queries whenever possible and in some situations even make sure the optimizer knows to make a generic plan, instead of focusing all its smartness around the first parameter values it encounters and then stick to that (i am referring to option( optimize for unknown ) that is available since 2008).

Then there is yet one more possibility. many developers use the SQL Server management studio to alter databases, sometimes just to place a new column in an estatically pleasing position withing the table.

DON'T EVER!!

I tell you why...management studio contains bugs that when a table needs to be rebuild lets filters on indexes suddenly disappear!

Oh...and don't forget disk, file and log (number of virtual log files) fragmentation.
The defaults (on earlier versions at least) set auto growth in percentages and is very nonsensical, causing fragmentation.

As you can see, the list of things that can make a database go south with respect to performance are numerous, in this regard its not even clear i am helping here other then to relay just this fact.
Post #1520238
Posted Friday, December 6, 2013 3:55 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 12:26 AM
Points: 2,840, Visits: 3,963
Another ONe cent.

Has the restore done on server having same hardware configuration(if done on different server ) ?


-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done
Post #1520489
Posted Monday, February 3, 2014 8:41 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 11:48 AM
Points: 2,962, Visits: 2,980
Hi

It depends what indexes were changed. If it was a clustered index, then have in mind that REBUILD-ing it does not rebuild the associated nonclustered indexes automatically unless the ALL keyword is specified.
It's the same for re-creating a clustered index. If it was the case, than practically, you have the nonclustered indexes useless.

Regards,
Igor Micev




Igor Micev,
SQL Server developer at Seavus
www.seavus.com
Post #1537365
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse