A Small Statspack Success

Doug's Oracle Blog

  • Home
  • Papers
  • Books
  • C.V.
  • Fun
  • Oracle Blog
  • Personal Blog

Dec 1: A Small Statspack Success

I'll warn you up front that this is going to be spectacularly lacking in detail but it's a simple and true example from the other week of the kind of thing I find Statspack useful for.

One of the developers scuttled round to my desk one late shift very concerned about a production feed that had slowed to a crawl the day before. He'd spent most of this day going round in circles trying to persuade DBAs that something was wrong and was at the end of his tether ('Network problems' indeed!). These days I'm in the development team so I don't do production, but I could tell he was fed up so I said I'd take a quick look.

All of our databases have 15 minute snapshots going back 30 days so I asked him when the problem had first occurred and ran two reports for 30 minute intervals at the same time on two days - the day before the problem and the day of the problem. This would be adequate because this feed runs throughout the day.

As usual with Statspack, there was a ton of information and I suppose the skill comes in deciding where to look. Most of the time I'll look at the timed event profile at the start of the report and the SQL ordered by gets at the very least.

Here's the start of the SQL ordered by gets statement for the good day.

Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value
--------------- ------------ -------------- ------ -------- --------- ----------
15,480,730 127 121,895.5 28.0 117.44 289.69 169133436
Module: JDBC Thin Client
Select teamname AS rs_Team, teammanagername AS rs_TeamManager, S
tatus AS rs_Status, RESOURCETYPECODE AS rs_ResourceTypeCode, reg
ioncode AS rs_RegionCode, PayrollNumber AS rs_PayrollNumber, par
tyid AS rs_PartyId, managercontactnumber AS rs_ManagerContactNum
ber, ismanager AS rs_IsManager, installername AS rs_Name, idno A

5,311,261 6,914 768.2 9.6 204.55 3533.63 2400602673
Module: JDBC Thin Client
Select username AS rs_UserLogin, taskdescription AS rs_TaskDescr
iption, productname AS rs_ProductName, PortfolioOwnerName AS rs_
PortfolioOwnerName, PortfolioId AS rs_PortfolioId, partynumber A
S rs_PartyNumber, partyid AS rs_PartyId, offeringname AS rs_Offe
ringName, jobid AS rs_JobID, intrctnstatecode AS rs_State, inter

2,484,342 813 3,055.8 4.5 38.95 40.08 425417216
Module: JDBC Thin Client
Select SERVICECODE AS rs_ServiceCode, JOBTYPE AS rs_JobType, FMS
PRODUCTCODE AS rs_FmsProductCode, BUNDLENAME AS rs_BundleName, B
UNDLEID AS rs_BundleID from V_BSBINSTALLBUNDLEPICKER


And this is from the bad day. I've highlighted the two statements that have appeared that weren't there before.

Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value
--------------- ------------ -------------- ------ -------- --------- ----------
10,116,721 84 120,437.2 21.4 73.15 80.26 169133436
Module: JDBC Thin Client
Select teamname AS rs_Team, teammanagername AS rs_TeamManager, S
tatus AS rs_Status, RESOURCETYPECODE AS rs_ResourceTypeCode, reg
ioncode AS rs_RegionCode, PayrollNumber AS rs_PayrollNumber, par
tyid AS rs_PartyId, managercontactnumber AS rs_ManagerContactNum
ber, ismanager AS rs_IsManager, installername AS rs_Name, idno A

9,682,739 280 34,581.2 20.5 820.43 1744.27 404442202
Module: JDBC Thin Client
BEGIN ISR_SCMS_EXTRACT.ISR_VS_PUT_SCMS_RESULTS(:1); END;

9,678,951 52 186,133.7 20.5 819.86 1733.18 1081636089
Module: JDBC Thin Client
UPDATE VS_CONTROL_SUBSCRIBER_IDS SET SCMS_EXTRACT_REQUIRED = 'E'
WHERE SCMS_EXTRACT_REQUIRED = 'S' AND SCMS_REQUEST_DATE <= SYSD
ATE - :B1

2,738,922 3,887 704.6 5.8 99.47 1544.92 2400602673
Module: JDBC Thin Client
Select username AS rs_UserLogin, taskdescription AS rs_TaskDescr
iption, productname AS rs_ProductName, PortfolioOwnerName AS rs_
PortfolioOwnerName, PortfolioId AS rs_PortfolioId, partynumber A
S rs_PartyNumber, partyid AS rs_PartyId, offeringname AS rs_Offe
ringName, jobid AS rs_JobID, intrctnstatecode AS rs_State, inter


Now, and this is very important, because I was working together with the developer I could ask the simple question - 'do those statements look like they're anything to do with your job?' He recognised them instantly. Performance tuning always works best when it involves people with application knowledge, not just DBAs. Next I went back to look at the Statspack report for the good day, found those statements and could see that they were performing much more work on the bad day.

Now Statspack hasn't told me why the statement is performing more work, but it very quickly narrowed down what I needed to look at. It turned out that the UPDATE statement wasn't using an index that it had been previously.

Better still, because we save all of our object statistics for the CBO for at least 30 days, we could see which statistics had changed and investigate why Oracle was picking a different execution plan.

I would say this illustrated two benefits of Statspack. First, it's able to narrow your scope in some cases. Second, it's very low cost and quick to use. People had been looking at this problem for a *day*. The entire process of spotting the problem statement took less than 10 minutes and then maybe another 10 minutes narrowing down the change in the statistics that was causing the problem. If it's so quick to use (maybe in experienced hands) there isn't much cost if it turns out to be of no use. i.e. I think it's worth a try. That might not be a very rigorous or scientific statement but I'll do whatever it takes to solve business problems.

(Actually - updated later - the thing it most illustrates is that Statspack can show a change in behaviour after the fact as long as you have it switched on everywhere)

This was on Oracle 9.2.0.7. Had it been on 10g, we would probably have used AWR.

Posted by Doug Burns Comments: (7) Trackbacks: (2)

Trackbacks
Trackback specific URI for this entry

A More Complex Statspack Example - Part 1
Following on from the last Statspack example, up popped an example at work this week of another common reason I use Statspack - comparing the performance of different environments. It's also a nice illustration of some of Statspack's limitations.Because
Weblog: Doug's Oracle Blog
Tracked: Dec 06, 22:34
10g Statspack Improvements
In a comment on a previous blog, I said this&quot;there are some useful improvements in the 10g report - I might blog about those later.&quot;Well, Jonathan Lewis got there first, as usual Still, that's another post ticked off the list
Weblog: Doug's Oracle Blog
Tracked: Feb 01, 05:53
PingBack
Weblog: jonathanlewis.wordpress.com
Tracked: Jan 26, 18:46

Comments
Display comments as (Linear | Threaded)

#1 - Noons said:
2006-12-04 01:15 - (Reply)

Particularly relevant to something I've been involved with recently! Thanks for this blog, very timely.

One question: do you see any need for statspack with 10g's AWR on by default?

I ask this because the 10g installation includes the traditional statspack scripts as well as the AWR ones. This leaves me wondering if there is any need for statspack with AWR.

#1.1 - Doug Burns said:
2006-12-04 01:41 - (Reply)

Thanks ;-)

One question: do you see any need for statspack with 10g's AWR on by default?

Yes I do because

a) Statspack is free (as in beer), so we can have it enabled everywhere without considering cost. (As a side-note, there's also my individual perspective as an independent contractor, which is that I know Statspack will be available wherever I go, much like sqlplus)

b) We can use it everywhere, because we still have a large number of 9.x and 8.x databases.

Interestingly, as well as including the Statspack scripts in the 10g installation, Oracle continue Statspack development alongside AWR. I'm not sure how long that will continue but there are some useful improvements in the 10g report - I might blog about those later.

They must understand that not all databases will be licenced to run the AWR report ;-)

#2 - Simon Kelsey 2006-12-04 16:15 - (Reply)

Doug, I couldn't agree more. There are more sophisticated (and expensive) tools, but statspack is also my first line of attack. In the majority of cases I find it leads to the problem, or at least points you enough in the right direction.

I could also recount several situations (spookily enough on the same site as you currently are) where statspack lead me to diagnose a fault in a matter of minutes where others had already spent a good deal of time without any "luck".

Worth pointing out that this only works if you have frequent snaps - every 15 mins seems to work well for me. A lot of folks tend to snap hourly but I find this mostly dilutes the information too much to be of use...

#3 - vidya said:
2006-12-04 21:30 - (Reply)

Doug,
That was a good example on how we can benefit from statspack - It is probably the only tool we have to go back in time and view high usage sql statements back in time (we use spotlight and foglight ; spotlight cannot go back in time and with foglight I am not sure it records high usage sql statements back in time- it records other wait events though). If there are any other tools out there that can give sql usage back in time in 8i and 9i that will be great to know.

#3.1 - Doug Burns said:
2006-12-05 03:38 - (Reply)

If there are any other tools out there that can give sql usage back in time in 8i and 9i that will be great to know.

I'm sure there are but none that I use regularly but I wonder why you would want one when Statspack can give you that and it costs nothing?

#4 - Noons said:
2006-12-05 03:05 - (Reply)

Hmmmm.....
given the paltry state of so many 10gr2 functionality that still doesn't work or needs patch xyzzy applied, it's probably not a bad idea to keep statspack running.
(on my 5th 7445 error in less than three weeks after 10gr2 upgrade!...)

Sure, roll-on 11g: let's hope that this one actually works?

#5 - Doug Burns said:
2006-12-05 03:36 - (Reply)

I noticed that Jonathan Lewis has a different view of the parallel development of Statspack and AWR in one of his comments on his blog

http://jonathanlewis.wordpress.com/2006/11/29/analysing-statspack-pt1/#comments


Add Comment

Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
BBCode format allowed
 
 

Statistics on Partitioned Tables

Contents

Part 1 - Default options - GLOBAL AND PARTITION
Part 2 - Estimated Global Stats
Part 3 - Stats Aggregation Problems I
Part 4 - Stats Aggregation Problems II
Part 5 - Minimal Stats Aggregation
Part 6a - COPY_TABLE_STATS - Intro
Part 6b - COPY_TABLE_STATS - Mistakes
Part 6c - COPY_TABLE_STATS - Bugs and Patches
Part 6d - COPY_TABLE_STATS - A Light-bulb Moment
Part 6e - COPY_TABLE_STATS - Bug 10268597

Comments

Doug Burns about 10053 Trace Files - Different Plan in Different Environments
Tue, 02.04.2013 08:57
You're welcome. Now I just nee d to pull my finger out and ac tually come up [...]
Howard Rogers about 10053 Trace Files - Different Plan in Different Environments
Mon, 01.04.2013 23:08
Makes a big difference, so tha nks for that! With two brow ser windows, o [...]
stelioscharalambides.com about 10053 Trace Files
Sat, 30.03.2013 16:28

Upcoming Presentations

Bookmark

Open All | Close All

Syndicate This Blog

  • XML RSS 2.0 feed
  • ATOM/XML ATOM 1.0 feed
  • XML RSS 2.0 Comments
  • Feedburner Feed

Powered by

Serendipity PHP Weblog

Show tagged entries

xml 11g
xml ACE
xml adaptive thresholds
xml ASH
xml Audit Vault
xml AWR
xml Blogging
xml conferences
xml Cuddly Toys
xml Database Refresh
xml DBMS_STATS
xml Direct Path Reads
xml Fun
xml grid control
xml hotsos 2010
xml listener
xml Locking
xml oow
xml oow2009
xml optimiser
xml OTN
xml Parallel
xml Partitions
xml Patching
xml swingbench
xml The Reality Gap
xml time matters
xml ukoug
xml ukoug2009
xml Unix/Shell
xml Useful Links

Disclaimer

For the avoidance of any doubt, all views expressed here are my own and not those of past or current employers, clients, friends, Oracle Corporation, my Mum or, indeed, Flatcat. If you want to sue someone, I suggest you pick on Tigger, but I hope you have a good lawyer. Frankly, I doubt any of the former agree with my views or would want to be associated with them in any way.

Design by Andreas Viklund | Conversion to s9y by Carl