Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> RE: When stats trash your performance

RE: When stats trash your performance

From: Bobak, Mark <>
Date: Wed, 7 Dec 2005 14:17:29 -0500
Message-ID: <>

Hi Stephen,  

I'm not sure I can point you to specific documentation, however, for a stable, running, production system, you want your execution plans to be stable. So, the only "safe" time to update statistics is when updating them will have little or no effect. But if updating them will have little or no effect, then why update them in the first place?  

Ultimately, I think there are two schools of thought here: 1.) If the system is stable, don't analyze objects. Leave the stats where they are, and Oracle will continue to supply stable execution plans. This is the "if it ain't broke, don't fix it" school of thought.  

2.) Analyze early and often. The CBO is far smarter than I ever will be. The better my stats are, the better off my performance will be. This is the "I have faith in the church of Oracle. Oracle is the one true light, and the way." school of thought.  

The reality is probably somewhere in between.  

In my shop, we are fortunate enough to have a full preproduction environment which is equal in size to production. Every 3-6 months, we clone from prod into preprod, so we have fresh data. Then, in preprod, along with a software release, we analyze objects, and do our performance testing in preprod w/ the fresh stats. When we roll our release into prod, we export stats from preprod and import to prod. In this way, we have some controlled method of moving (relatively) fresh stats into prod on a semi-regular basis.  

I know, this doesn't completely answer your question....just some thoughts on the subject from my perspective. I hope it's helpful.  

Finally, I gotta ask: Why the heck are you bouncing for nightly backups on a production server? Hot backups are a good thing! ;-)  


[] On Behalf Of stephen booth Sent: Wednesday, December 07, 2005 1:59 PM To:
Subject: When stats trash your performance

I've heard mention in a number of talks that you shouldn't gather stats very often, even not at all once a system is bedded in, as it can cause your database to start performing really badly. I don't recall any one ever saying, or ever reading, an explanation as to why this might happen. Perhaps I'm looking at it from the wrong perspective but it seems axiomic that the fresher your stats the better decisions CBO is likely to make.

I've Googled and can't really find anything that seems relevant other than some references to gathering stats invalidating existing plans so meaning Oracle has to do a hard parse.

Can anyone point me to any documentation that might explain why this might happen. It's not something I've really had to deal with in the past (getting the system running and occasionally trying to tune the server to reduce/eliminate waits before it goes live has been most of what I've been involved in, we don't write code in house so SQL tuning hasn't really featured). Something with pointers as to how to resolve such problems would be very useful as well.

What has triggered this question is I've just been hit by a situation where one of our systems was running OK (performance wasn't great but was acceptable and wasn't noticably worse than when the system was put in) then one of the sysadmins (not DBA) was told by our FM supplier to analyze a half dozen tables and associated indexes that were used by a new module that's due to go live soon and had been loaded with some historical information that was required. He did so and, so he claims, the system started running noticably slower shortly after. He then decided to analyze all the rest of the tables and their indexes. Performance got worse. Four days later they notified me (for political reasons I have no involvement with this system or any other system that has gone live) and basically said "it's running slow, fix it.". I don't know if there were any existing stats which got over written (I've asked, still waiting for a response), if there weren't I'm considering just deleting all the stats and seeing if that helps.

This system is shutdown every night for backup so the plans get wiped out anyway.



It's better to ask a silly question than to make a silly assumption.

-- Received on Wed Dec 07 2005 - 13:15:48 CST

Original text of this message