Frequent changed table stats problem [message #562841] |
Mon, 06 August 2012 05:16  |
snowball
Messages: 213 Registered: April 2006 Location: China
|
Senior Member |

|
|
Hi, Guys
We have a table around serverial billion records.
In most of the time, this table change(many actions with delete and insert). When executing some sqls we found some of them are not optimal execution plan, because the statistics may be stale. But manually gather the statistics may cost a lot of time and also bring very bad performance.
The where condition in issue sqls mostly contain a date time range to fetch some records.
Some of my fellows, suggest to use dbms_stats.SET_*_STATISTICS procedures (such as SET_COLUMN_STATS, SET_INDEX_STATS, etc) to configure the statistics in order to let those sql have a correct plan.
Is this resonable? Any suggestion?
Thanks very much,
Milo
[Updated on: Mon, 06 August 2012 05:18] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
| Re: Frequent changed table stats problem [message #564086 is a reply to message #562985] |
Tue, 21 August 2012 06:23   |
 |
Kevin Meade
Messages: 1787 Registered: December 1999 Location: Connecticut USA
|
Senior Member |
|
|
It is one of the techniques that advanced tuners use when faced with difficult situations. In that respect it is quite reasonable.
However, you should accept some facts about it:
- this is an advanced tuning method. Most people do not understand statistics in Oracle well and thus doing this is difficult for them.
- this requires some rigour. For example, if you collect stats, these values may be overwritten. So you need a stats collection plan. Do you have one?
- may not help. Though a valuable tool, there are situations where these numbers are ignored in favor of defaults in which case it may not help. Do not get let this stop you from moving forward. Keep thinking till you find a solution that works for you.
- you need to document and train. Since this is an advanced method of tuning, you should be thinking about how to explain it to others, and how to train them to be able to do it themselves. Otherwise, no one will have an opportunity to appreciate your brilliance and carry on your brilliant scheme.
Kevin
[Edit MC: change code tags to list ones for the enumeration]
[Updated on: Tue, 21 August 2012 08:06] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Frequent changed table stats problem [message #564171 is a reply to message #564170] |
Tue, 21 August 2012 15:44   |
 |
Kevin Meade
Messages: 1787 Registered: December 1999 Location: Connecticut USA
|
Senior Member |
|
|
That is OK. I lost most of my ego years ago. Besides, I don't own the info, I was just passing along what someone taught me.
Naturally you are correct, statistics is only one reason. But it is as good a place to start as any.
Maybe you could post some examples of you using v$sql_shared_cursor in diagnosing or othewise analyzing some performance facts. If you examples make sense to me, I will steal them and use them to teach others.
Kevin
[Updated on: Tue, 21 August 2012 15:46] Report message to a moderator
|
|
|
|
|
|
| Re: Frequent changed table stats problem [message #564286 is a reply to message #564199] |
Wed, 22 August 2012 08:44  |
 |
msol25
Messages: 214 Registered: June 2011 Location: Mumbai
|
Senior Member |
|
|
Dear Snowball,
Please apply exchange partition concept on your update records
and create partition for every day insert records using exchange
partition concept and then create local index for that partition
and then calculate the statistics for that partition only.
Thanks & Regards
Saurabh
[Updated on: Wed, 22 August 2012 09:10] Report message to a moderator
|
|
|
|