DBMS_STATS. CREATE_STAT_TABLE
HelloCan someone help me understand the different columns of the stat_table and how to interpret the data in this table?
Kind regards
Narayan
user7202581 wrote:
HelloCan someone help me understand the different columns of the stat_table and how to interpret the data in this table?
I thought that I had published a breakdown of this, but I can't find it online. However, this is a very old link which is probably more often correct, although incomplete which could help you get started.
It is fairly easy to work, however. Just go through the different scenarios:
create a table with two columns, gather stats with no histograms, then save its stats, look at the table - then truncate the table stat
Repeat without histograms
Repeat after the addition of an index
Repeat using a simple table partitioned
Repeat using a composite partitioned table
Repeat using an IOT with no overflow
Repeat using an IOT with overflow
etc.
Concerning
Jonathan Lewis
http://jonathanlewis.WordPress.com
To get answers to common questions of SQL and PL/SQL (including how to mark your code):
Re: 3. how to improve the performance of my query? / My query is slow.
Tags: Database
Similar Questions
-
Hello
11g R2, Win 2008, I have two DBs. same Oracle Home. The same standard query takes 3 or 4 hours on slow DB and 200 ms on a fast. Then I exported profile Sql of DBfast to DBslow (using SQLT tool). The problem is not resolved. Always 3, 4 or slower. The number of rows in the tables is not too different, and more, in slower tables is smaller. The data files for both DBs are on the same disk. How to explain or possibly resolve this difference in execution time? Thanks for your ideas.
We cannot change the query syntax. First of all, this is a standard request of PS. Second, if the syntax is wrong, it should be slow on the two DBs.=========================RAPID================================ SQL> show parameter optimizer optimizer_capture_sql_plan_baselines boolean FALSE optimizer_dynamic_sampling integer 2 optimizer_features_enable string 11.2.0.3 optimizer_index_caching integer 0 optimizer_index_cost_adj integer 100 optimizer_mode string ALL_ROWS optimizer_secure_view_merging boolean TRUE optimizer_use_invisible_indexes boolean FALSE optimizer_use_pending_statistics boolean FALSE optimizer_use_sql_plan_baselines boolean TRUE SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_AWR('2prnxw2rdv','9176078')); SQL_ID 2prnxw2rdvfkd -------------------- SELECT A.BUSINESS_UNIT, D.DESCR FROM PS_SP_RECV1_NONVW A, PS_SP_RCV1_NONVWLN D WHERE D.BUSINESS_UNIT LIKE 'IF%' AND D.BUSINESS_UNIT=A.BUSINESS_UNIT AND D.LANGUAGE_CD='FRA' UNION SELECT BUSINESS_UNIT, DESCR FROM PS_SP_RECV1_NONVW A WHERE BUSINESS_UNIT LIKE 'I%' AND NOT EXISTS (SELECT 'X' FROM PS_SP_RCV1_NONVWLN D WHERE D.BUSINESS_UNIT=A.BUSINESS_UNIT AND D.LANGUAGE_CD='FRA') ORDER BY 1 Plan hash value: 1299176078 -------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | | 9 (100)| | | 1 | SORT ORDER BY | | 4 | 170 | 9 (34)| 00:00:01 | | 2 | SORT UNIQUE | | 4 | 170 | 8 (63)| 00:00:01 | | 3 | UNION-ALL | | | | | | | 4 | NESTED LOOPS | | 1 | 62 | 3 (0)| 00:00:01 | | 5 | NESTED LOOPS | | 1 | 56 | 3 (0)| 00:00:01 | | 6 | NESTED LOOPS | | 1 | 48 | 2 (0)| 00:00:01 | | 7 | NESTED LOOPS | | 1 | 14 | 1 (0)| 00:00:01 | | 8 | INDEX RANGE SCAN | PSCRECV_HDR | 1 | 8 | 1 (0)| 00:00:01 | | 9 | INDEX UNIQUE SCAN | PS_BUS_UNIT_TBL_FS | 1 | 6 | 0 (0)| | | 10 | TABLE ACCESS BY INDEX ROWID| PS_BUS_UNIT_LANG | 1 | 34 | 1 (0)| 00:00:01 | | 11 | INDEX UNIQUE SCAN | PS_BUS_UNIT_LANG | 1 | | 0 (0)| | | 12 | INDEX RANGE SCAN | PSCRECV_HDR | 1 | 8 | 1 (0)| 00:00:01 | | 13 | INDEX UNIQUE SCAN | PS_BUS_UNIT_TBL_FS | 1 | 6 | 0 (0)| | | 14 | NESTED LOOPS | | | | | | | 15 | NESTED LOOPS | | 1 | 36 | 2 (0)| 00:00:01 | | 16 | INDEX RANGE SCAN | PSCRECV_HDR | 1 | 8 | 1 (0)| 00:00:01 | | 17 | NESTED LOOPS | | 1 | 24 | 1 (0)| 00:00:01 | | 18 | NESTED LOOPS | | 1 | 16 | 0 (0)| | | 19 | INDEX UNIQUE SCAN | PS_BUS_UNIT_LANG | 1 | 10 | 0 (0)| | | 20 | INDEX UNIQUE SCAN | PS_BUS_UNIT_TBL_FS | 1 | 6 | 0 (0)| | | 21 | INDEX RANGE SCAN | PSCRECV_HDR | 1 | 8 | 1 (0)| 00:00:01 | | 22 | INDEX UNIQUE SCAN | PS_BUS_UNIT_TBL_FS | 1 | | 0 (0)| | | 23 | TABLE ACCESS BY INDEX ROWID | PS_BUS_UNIT_TBL_FS | 1 | 28 | 1 (0)| 00:00:01 | -------------------------------------------------------------------------------------------------------- 40 ligne(s) sÚlectionnÚe(s). SQL> select count(*) from sysadm.PS_BUS_UNIT_LANG; 1 SQL> select count(*) from sysadm.PS_BUS_UNIT_TBL_FS; 170 ==================SLOW========================= SQL> show parameter optimizer optimizer_capture_sql_plan_baselines boolean FALSE optimizer_dynamic_sampling integer 2 optimizer_features_enable string 11.2.0.3 optimizer_index_caching integer 0 optimizer_index_cost_adj integer 100 optimizer_mode string ALL_ROWS optimizer_secure_view_merging boolean TRUE optimizer_use_invisible_indexes boolean FALSE optimizer_use_pending_statistics boolean FALSE optimizer_use_sql_plan_baselines boolean TRUE Plan hash value: 1299176078 ---------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | ---------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | | | 915M(100)| | | 1 | SORT ORDER BY | | 25G| 1383G| 1056G| 915M (1)|999:59:59 | | 2 | SORT UNIQUE | | 25G| 1383G| 1538G| 593M (1)|999:59:59 | | 3 | UNION-ALL | | | | | | | | 4 | NESTED LOOPS | | 25G| 1383G| | 108M (2)|362:48:58 | | 5 | NESTED LOOPS | | 25G| 1240G| | 107M (1)|359:49:20 | | 6 | NESTED LOOPS | | 158K| 6798K| | 162K (1)| 00:32:32 | | 7 | NESTED LOOPS | | 161K| 2213K| | 687 (2)| 00:00:09 | | 8 | INDEX RANGE SCAN | PSCRECV_HDR | 161K| 1264K| | 682 (1)| 00:00:09 | | 9 | INDEX UNIQUE SCAN | PS_BUS_UNIT_TBL_FS | 1 | 6 | | 0 (0)| | | 10 | TABLE ACCESS BY INDEX ROWID| PS_BUS_UNIT_LANG | 1 | 30 | | 1 (0)| 00:00:01 | | 11 | INDEX UNIQUE SCAN | PS_BUS_UNIT_LANG | 1 | | | 0 (0)| | | 12 | INDEX RANGE SCAN | PSCRECV_HDR | 161K| 1264K| | 681 (1)| 00:00:09 | | 13 | INDEX UNIQUE SCAN | PS_BUS_UNIT_TBL_FS | 1 | 6 | | 0 (0)| | | 14 | NESTED LOOPS | | | | | | | | 15 | NESTED LOOPS | | 8095 | 276K| | 8779 (1)| 00:01:46 | | 16 | INDEX RANGE SCAN | PSCRECV_HDR | 8095 | 64760 | | 682 (1)| 00:00:09 | | 17 | NESTED LOOPS | | 161K| 3794K| | 681 (1)| 00:00:09 | | 18 | NESTED LOOPS | | 1 | 16 | | 0 (0)| | | 19 | INDEX UNIQUE SCAN | PS_BUS_UNIT_LANG | 1 | 10 | | 0 (0)| | | 20 | INDEX UNIQUE SCAN | PS_BUS_UNIT_TBL_FS | 1 | 6 | | 0 (0)| | | 21 | INDEX RANGE SCAN | PSCRECV_HDR | 161K| 1264K| | 681 (1)| 00:00:09 | | 22 | INDEX UNIQUE SCAN | PS_BUS_UNIT_TBL_FS | 1 | | | 0 (0)| | | 23 | TABLE ACCESS BY INDEX ROWID | PS_BUS_UNIT_TBL_FS | 1 | 27 | | 1 (0)| 00:00:01 | ---------------------------------------------------------------------------------------------------------------- Note ----- - SQL profile "sqlt_s75336_p1" used for this statement 44 ligne(s) sÚlectionnÚe(s). SQL> select count(*) from sysadm.PS_BUS_UNIT_LANG; 22 SQL> select count(*) from sysadm.PS_BUS_UNIT_TBL_FS; 22
Hello
Before you import the stats in slowDB please take backup of current statistics in the slowDb. In case any question we can return back current stats
EXEC ('SCHEMA_NAME', 'SCHEMA_NAME_STATS_22SEP2012_NEW') DBMS_STATS.create_stat_table;
EXEC DBMS_STATS.export_schema_stats ('SCHEMA_NAME', 'SCHEMA_NAME_STATS_22SEP2012_NEW', NULL, 'SCHEMA_NAME');Kind regards
Jey -
IMPORT_INDEX_STATS
Hello friends
I try to copy the index statistics of one schema to another using DBMS_STATS. EXPORT_INDEX_STATS... Here is the detailed procedure. All statements are properly executed bt I don't see not the stats really have copied to index of destination which is in the same database bt another schema.
After doing this... I see that last analyses and num_rows value for both indices is different...exec DBMS_STATS.CREATE_STAT_TABLE('dest_schema','STATS_TABLE' ,'tablespace'); exec dbms_stats.export_index_stats(ownname=>'source_schema',indname=>'source_ind',stattab=>'STATS_TABLE',statown=>'dest_schema'); exec dbms_stats.import_index_stats(ownname=>'dest_schema',indname=>'dest_index',stattab=>'STATS_TABLE',statown=>'dest_schema',force=>TRUE);
Please help me solve this problem
Thanxnjafri wrote:
exec DBMS_STATS.CREATE_STAT_TABLE('dest_schema','STATS_TABLE' ,'tablespace'); exec dbms_stats.export_index_stats(ownname=>'source_schema',indname=>'source_ind',stattab=>'STATS_TABLE',statown=>'dest_schema'); exec dbms_stats.import_index_stats(ownname=>'dest_schema',indname=>'dest_index',stattab=>'STATS_TABLE',statown=>'dest_schema',force=>TRUE);
It seems that if you try to import the index statistics that Oracle will not able to find in the stats_table.
If you want this to work, you need to change the contents of the table of stats, something like - updated c1 where type = "I" and c1 = "SOURCE_IND."Oracle Corp. does not approve this strategy - at least, one of my clients has been told by a support analyst Oracle that they would be not supported if they had problems after using this technique.
I personally use dbms_stats.get_index_stats () to read the whole source of the stats, then dbms_stats.set_index_stats () to write to the target index.
Update: I just posted on my blog [http://jonathanlewis.wordpress.com/2010/01/06/copy-stats/].
Concerning
Jonathan LewisPublished by: Jonathan Lewis on January 6, 2010 14:26
Adding the URL. -
What is the meaning of the statistical Tables?
Hello
I try to use the DBMS_STATS to collect statistics.
I did the following:
BEGIN
DBMS_STATS.create_stat_table (ownname = > 'MYOWNER', stattab = > 'STAT_TAB');
DBMS_STATS.gather_table_stats (ownname = > 'MYOWNER', tabname = > "MYTABLE", stattab = > 'STAT_TAB');
END;
*/*
and when I look at the STAT_TAB table I find that it's been created with this description:
SQL > desc STAT_TAB
Name Null? Type
----------------------------------------- -------- ----------------------------
STATID VARCHAR2 (30)
TYPE CHAR(1)
VERSION NUMBER
FLAGS NUMBER
C1 VARCHAR2(30)
C2 VARCHAR2(30)
C3 VARCHAR2(30)
C4 VARCHAR2(30)
C5 VARCHAR2(30)
N1 NUMBER
N2 NUMBER
N3 NUMBER
N4 NUMBER
N5 NUMBER
N6 NUMBER
N7 NUMBER
N8 NUMBER
N9 NUMBER
N10 NUMBER
N11 NUMBER
N12 NUMBER
D1 DATE
R1 RAW(32)
R2 RAW(32)
CH1 VARCHAR2 (1000)
How I can undestand the meaning of the columns? I can't get the meaning of the names that oracle did by default, I guess. My version is Oracle 8.1.7.
Thank youCheck here:
[http://skdba.blogspot.com/2006/06/keeping-history-of-cbo-stats.html]-André
-
Hi all
This is related to the stats of the production to QA scheme.
We have two DB
Production: ABC
QA: XYZ
Now,.
I have not exported schema ABC production and imported the complete schema using "fromuser touser" option for exp in XYZ.
Then I created the table for production stats (ABC) to:
exec dbms_stats.create_stat_table (ownname = > 'ABC', stattab = > 'ABCSTATS', tblspace = > 'ABC_DATA');
Then, I collected stats:
exec dbms_stats.export_schema_stats (ownname = > 'ABC', statown = > 'ABC', stattab = > 'ABCSTATS');
then exported the table "ABCSTATS" in file exp.dmp and imported into the QA XYZ database.
PROD: file = / exp.dmp exp tables = ABCSTATS
QA: imp leader = exp.dmp = ABC = XYZ touser fromuser
Now I have complete PRODUCTION of QA and statistical data for the production of too much in the ABCSTATS table.
Now, when I do
exec dbms_stats.import_schema_stats (ownname = > 'XYZ', statown = > 'XYZ', stattab = > 'ABCSTATS');
Then the command is executed successfully. But his stats are not loaded from generation.
I have the stats of the future costs to a single request as 40,000 in production while in QA it comes as 7 000 only.
Now the question is: are there at - it something I am doing wrong? Or is it possible to load stats diagram to another diagram to the same data structure.
OS: Sun10
DB: 10G 10.2.0.3.0
Thank you
APS
Published by: aps April 13, 2009 09:31This possible import stats different schame in others? Can anyone confirm?
its possible. You must perform some manual tasks.
Create table stat in source and stats source of export schema.
export stat source table using the exp utility.
transfer and upload the stat table in the target database.Now, the Stat table schema is not available in your target. Thus, you must update the column in table STAT C5 on behalf of the target schema.
Now, import the stats using exec dbms_stats.import_table_stats.
Any particular reason you want to do this? Instead, you can collect statistics in the current target schema?
HTH
Anantha.Published by: André on April 13, 2009 14:13
-
Procedure CREATE_STAT_TABLE
DB: 10.2.0.2
OS: Solaris 5.8
exec DBMS_STATS. CREATE_STAT_TABLE (PRDPUB VARCHAR2, FULL_PUB_STATS_22APR2010 IN VARCHAR2 DEFAULT NULL);
ERROR on line 1:
ORA-06550: line 1, column 46:
PLS-00103: encountered the symbol "VARCHAR2" when awaits an of the
Next:
. ( ) , * @ % & | = - + <>/ mod rest isn't
rem range = >... < a superscript (*) > <>or! = or ~ = > = < = <>
and as LIKE2_ LIKE4_ LIKEC_ in the reports between use.
Member of multiset SUBMULTISET_
ORA-06550: line 1, column 103:
PLS-00103: encountered the symbol ";" when expecting one of the following values:
return
The mistake of launching an above. Please indicate the correct syntax
exec DBMS_STATS. EXPORT_SCHEMA_STATS (PRDPUB VARCHAR2, FULL_PUB_STATS_05AUG2010 IN VARCHAR2 DEFAULT NULL); exeTry to call the procedure in this way
exec DBMS_STATS. CREATE_STAT_TABLE (ownname => 'PRDPUB', stattab => 'FULL_PUB_STATS_22APR2010');
or
exec DBMS_STATS. CREATE_STAT_TABLE ("PRDPUB", "FULL_PUB_STATS_22APR2010");
and it is the same for EXPORT_SCHEMA_STATSmore information:
http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14258/d_stats.htm#i1049486Edited by: Kecskemethy August 5, 2010 04:06
-
Run DBMS_STATS. SET_TABLE_STATS in the package
Hello
I tried to put the table of statistics through DBMS_STATS. SET_TABLE_STATS for the table, I'm not owner.
When I use the command SQL * Plus, it works fine.
When I use the same command in the package, I got an error:
ERROR on line 1:
ORA-20000: TABLE 'XXX '. "' YYYYY ' does not exist or insufficient privileges
ORA-06512: at "SYS." DBMS_STATS", line 4455
ORA-06512: at "SYS." DBMS_STATS", line 10128
ORA-06512: at "TKPA. KOPA_ORP_RELACIJE', line 13
ORA-06512: at line 2
User a role DBA and ALTER, DELETE, INDEX, INSERT and SELECT, UPDATE, REFERENCES, ON COMMIT REFRESH, QUERY REWRITE, DEBUG, FLASHBACK on table.
Y at - it an idea?
Thank you and best regards.
Maybe
Read memos to use SET_TABLE_STATS in http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_stats.htm#ARPLS059
To call this procedure, you must be the table owner, or you need the
ANALYZE
ANY
privilege. For the objects belonged toSYS
, you must be the owner of the table, or you mustANALYZE
ANY
DICTIONARY
privilege or theSYSDBA
privilege.Concerning
Etbin
http://docs.Oracle.com/CD/E11882_01/AppDev.112/e25519/subprograms.htm#LNPLS00809 can be useful also
-
Guys,
Please let know us if it is possible to run dbms_stats.gather_table_stats in "start = > Execute until off-peak hours = > take a break during peak times = > restart from where he was arrested after the rush hour" mode.
I partitioned table with mammoth number of records requiring full table statistics collection once all 3 months. Stats gathering is so expensive that it takes almost 2 days to complete. Our goal is to ensure that no SQL that runs during peak hours (15:00 to 22:00 hours) is affected by the collection of statistics. That's why we would like the stats collection to run above mode.
Ideas, suggestions would be very appreciated and I will receive with the profound esteem.
-Bugs
Like others, I wonder why full stats are required.
You nightly stats together people with reduced mobility?
Check dba_tab_modifications for the changes made to the table, your stats every night, whether its stats are needed comes from there so if a partition has no 10% change, why you re - collect his stats for her? There are a few other things going on behind the scenes, but close enough. Even if you set additional stats there and kick that off, he'll simply choose the following who did not, risking several work trying to do the same thing
theres probably 10 different ways to act how you're good with plql but generate your work statistics with something like that, then open multiple windows of sqlplus and divide it into sections while you are in the collection of statistics on several pieces at the same time. Failure could write some autonomous plsql proc that analyzes a partition that went in there and call that any amount of time passing in the partition in a loop, but you get the idea of gathering statistics on more than one partition at the same time.
Change the value of table_owner and table_name
exec DBMS_STATS. FLUSH_DATABASE_MONITORING_INFO;
Select the command from
(select (nvl(a.updates,0) + nvl(a.inserts,0) + nvl(a.deletes,0)) * 100)
/ nvl(b.num_rows,1) as change.
"exec DBMS_STATS. GATHER_TABLE_STATS (' |) '''' || "TABLE_OWNER" | '''' || ',' || '''' || 'TABLE_NAME ' | '''' || ', granularity =>' | '''' || 'PARTITION | ''''|| ', PARTNAME =>' | '''' || a.PARTITION_NAME | '''' || ', ESTIMATE_PERCENT => DBMS_STATS. AUTO_SAMPLE_SIZE, METHOD_OPT => ' | '''' || 'FOR ALL COLUMNS SIZE AUTO ' | '''' || ')' as a command
of dba_tab_modifications a, b dba_tab_partitions
where a.table_name as "TABLE PARTITIONNEE YOUR BIG".
and a.table_name = b.table_name
and a.partition_name = b.partition_name
and nvl(a.updates,0) + nvl(a.inserts,0) + nvl(a.deletes,0) > 0
)
where to change > = 10
-
I have a 11.2.0.4 install. I ran the DBMS_STATS. GATHER_SYSTEM_STATS, but after reviewing the statistics, the mreadtim and the sreadtim are null.
JWF wrote:
I had an interval of 15 minutes, 30 minutes and 2 hours. Sometimes, the SREADTIM is filled, and sometimes the other read times are met. But I still see other statistics such as iotfrspeed or mreadtim. So, what happens if you don't get all the stats? The CBO will use those by default, and others?
You must understand that the statistics system are there different flavors (NOWORKLOAD compared to the workload) and there are two corresponding sets of stats.
Statistics system NOWORKLOAD complete: cpuspeednw, ioseektim, iotfrspeed
Note that if you don't explicitly realize the statistics gathering system NOWORKLOAD the optimizer uses a * default * together statistics system NOWORKLOAD based on default, IOSEEKTIM and IOTFRSPEED - this is the default behavior for most of the facilities which do not bother to do something for his stats of individual system.
Complete system of workload stats: maxthr, slavethr, sreadtim, mreadtim, MBRC, cpuspeed
Note that for the system of workload statistics some stats could be depopulated if no corresponding activity took place during the gathering stats (no single block reads-online no SREADTIM no readings diluvium-online no MREADTIM, MBRC, no parallel execution-online no SLAVETHR, MAXTHR etc.). In this case, I believe that the official documentation available is not quite right in saying that the missing values will be synthesized / derived from default values, but the calculation will return you to (default) NOWORKLOAD system stats depending on which parameter is missing (e.g. missing / invalid SREADTIM / MREADTIM: these values are essential for the calculation of costs, so come back to NOWORKLOAD)
Just follow the links (official doc and my series) provided by Martin for more details.
Randolf
-
exec dbms_stats.set_column_stats
Hi all
on 11.2.0.4,.
If I run:
exec (dbms_stats.set_column_stats)
OWNNAME = > 'FLINTSTONE ',.
TABNAME = > 'FRED ',.
NULLCNT = > 100000000)
DISTANCE = > 10;
How can I check the result? In what table? Any query see the new REMOTE value?
Thank you.
DBA_TAB_COLS
-
DBMS_STATS, unexpected behavior?
Hello
I was doing an exercise to create migrated/chained rows for a table (ROW_CHAIN_MIG). [using 11.2.0.1]
After inserting/updating of the lines in the table, I tried collecting statistics for the table to check the USER_TABLES. CHAIN_CNT
using the DBMS_STATS. GATHER_TABLE_STATS as:
----------------------------
SQL > exec dbms_stats.gather_table_stats (-)
> ownname = > 'SYS '.
(> tabname = > 'ROW_CHAIN_MIG');
SQL > select chain_cnt from user_tables where table_name = 'ROW_CHAIN_MIG ';
CHAIN_CNT
----------
0
----------------------------
But he returns to zero count for the chained rows.
When I did an ANALYZE TABLE... CALCULATE STATISTICS, he returned 3 as number of chained rows
----------------------------
SQL > analyze table row_chain_mig where compute statistics;
SQL > select chain_cnt from user_tables where table_name = 'ROW_CHAIN_MIG ';
CHAIN_CNT
----------
3
----------------------------
Is this expected behavior of the DBMS_STATS. GATHER_TABLE_STATS? (i.e. it does not collect statistics CHAIN_CNT)
My understanding is DBMS_STATS to collect all the statistics gathered by ANALYZE & vbLf & stats no longer needed by the CBO.
OR was it there something missing from the DBMS_STATS this stat (CHAIN_CNT) has been missed.
TIA.
The analyze command should not be used to collect optimizer statistics, but, as you noted, it will capture the chain_cnt (which does not differentiate between migrated lines, lines chained and lines chained 'intra-block' (i.e. the lines containing more than 255 columns) while dbms_stats.does do not attempt to capture a chain_cnt.) It is the expected behavior.
Unfortunately (or not, depending on your point of view) the optimizer will use the chain_cnt in his calculations, if you use analyze to set. Of course, there are other differences between the dbms_stats and analyze versions of stats - so plans can change between the two even if you have not all chained rows.
See: analyse dbms_stats chain_cnt | Search results | Oracle scratchpad for a few comments - you need to follow a few links in the result list.
Concerning
Jonathan Lewis
-
DBMS_STATS. GATHER_SCHEMA_STATS in One SE edition
Hello
We are in 11.2.0.4 Standard Edition One. is DBMS_STATS. Included GATHER_SCHEMA_STATS in SE edition license?
Thank you and best regards.
Yes: is included: I checked my 11.2.0.4 database. In the Se you can not run this in parallel...
-
DBMS_STATS.gather_schema_stats: ORA-06502
I am trying to run under block to find all objects with stale stats. Is someone can you please tell me what I'm missing?
Set serveroutput on;
DECLARE
ObjList dbms_stats. ObjectTab;
BEGIN
DBMS_STATS. GATHER_SCHEMA_STATS (ownname = > null, OPTIONS = > "LIST out of DATE", objlist = > ObjList);
FOR i IN ObjList.FIRST... ObjList.LAST
LOOP
dbms_output.put_line (ObjList (i). ObjName | ' ' || ObjList (i). Type of the object);
END LOOP;
END;
/
ORA-06502: PL/SQL: digital error or value
ORA-06512: at line 5
06502 00000 - "PL/SQL: digital error or the value of %s.
* Cause: A digital arithmetic error, String, conversion or coercion
has occurred. For example, this error occurs if an attempt is made to
assign the NULL value to a variable declared NOT NULL, or if a
attempt to assign an integer greater than 99 to a variable
NUMBER (2) declared.
* Action: Change the data, how it is handled, or how it is so declared
that values do not violate the constraints.
Using the Oracle 12 c on Windows 7 version
You do not currently have all stale stats, so the dbms_stats. ObjectTab is empty. Take into account:
SQL > create type test_type as the object)
col1 2 varchar2 (10));
3.
Type of creation.
SQL > create type test_tab as table of test_type.
2.
Type of creation.
SQL > declare
l_tt 2 test_tab;
3. start
4. Select test_type (dummy)
5 bulk collect into l_tt
6 double
7 where 1 = 2;
8 because I in l_tt.first... l_tt loop. Last
9 dbms_output.put_line (l_tt (i) .col1);
10 end of loop;
11 end;
12.
declare
*
ERROR on line 1:
ORA-06502: PL/SQL: digital error or value
ORA-06512: at line 8 level
You should test if there is in fact no value before attempting to access the object.
SQL > declare
l_tt 2 test_tab;
3. start
4. Select test_type (dummy)
5 bulk collect into l_tt
6 double
7 where 1 = 2;
8 if l_tt.count > 0 then
9 because loop me in l_tt.first... l_tt. Last
10 dbms_output.put_line (l_tt (i) .col1);
11 end of loop;
12 on the other
13 dbms_output.put_line ('no statistics obsolete');
14 end if;
15 end;
16.
No stale stats
PL/SQL procedure successfully completed.
John
-
Call dbms_stats.gather_database_stats_job_proc)
Nice day:
Oracle 11g.2
Are there negative consequences to the deactivation of this call:
Call dbms_stats.gather_database_stats_job_proc)
It consumes a lot of resources when running. Is this necessary? Other options to disable if it's a must "contact"?
Thank you
Aqua
Aqua,
Given the fact that this job only recalculates * statistics of fade (where more than 10 percent of the table changed), this can lead to older execution plans and therefore evil.
A better measure would be to block statistics of the tables, where you do not WANT the statistics changed, using dbms_stats.lock.
Now you try to solve a problem with a big hammer. You can get yourself hurt in the process
Sybrand Bakker
Senior Oracle DBA -
Hi DBAs,
I'm in a learning phase and a newbie DBA. I got confused in the collection of statistics. Could someone explain the below? :
ANALYZE TABLE employee COMPUTE STATISTICS;
and
DBMS_STATS. GATHER_TABLE_STATS ('hr', 'employees');
The difference is that ANALYZE TABLE is obsolete for a long time and it's the wrong way of doing things.
Maybe you are looking for
-
Hi, this is not a technical thread. I wonder if is it a software can do the comparison of 2 LabVIEW files with slight differences? As I know, for the programming of the text, we can certainly compare and know what is the difference between 2 source c
-
Hello In the attached VI, when a Boolean value of BooleanArray is set to True, this line is highlighted. When you press the clear button, all highlighted lines are deleted. The next time that the table changes (triggered by the structure of the event
-
How can I get Windows XP to Windows 8?
I have Windows XP and need to get in tune with Windows 8. How can I do this?
-
Download all-in-one problems driver HP psc 1350
Hello I have a Toshiba laptop and a printer all-in-one hp psc 1350. Both worked fine until Sunday. Now the printer will not work. The light on the printer is constantly on when it is attached to the power, I can press the button, so it doesn't seem
-
BlackBerry Smartphones Blackberry 7280 user guide?
Anyone know where I can download the guide of the user for a blackberry 7280? I tried the blackberry site, but there is no link for this model. Thank you!