Analyze dbms_profiler
Hi folks!
I'm at the beginning of analyze PL/SQL code. I'm using dbms_profiler. For one of our packages, dbms_profiler show me:
Top 10 profiled source lines in terms of Total Time (plsql_profiler_data)
Top Total Time1 Times Executed Min Time2 Max Time2 Unit Owner Name Type Line Text
1 75.76 431010 0.00 0.01 1 USER package PACKAGE BODY 165 fetch c_IconsByDist bulk collect into l_IDs;
2 72.13 431010 0.00 0.01 1 USER package PACKAGE BODY 161 fetch c_CountByDist bulk collect into tmp_NumsAs you can see this row of code fetches cursor into collection. Cursor:
cursor c_IconsByDist is
select i.icon_id
from (select rownum as num, column_value as icon_id
from table(tmp_IDs)) i,
(select rownum as num, column_value as dist
from table(tmp_Distances)) d,
(select column_value as dist
from table(tmp_Nums)) t
where i.num = d.num and
d.dist = t.dist
order by d.dist;May be, I can speed up this piece of code? Any ideas :)
Regards,
Pavel.
Thanks for reply. Code of this function:
function get_icon(
p_Table varchar2,
p_ID number)
return number
as
l_ID number;
l_x number;
l_y number;
l_flag boolean;
l_Table varchar2(128);
arr_IDs gg_utils.TSuperNumberArray := gg_utils.TSuperNumberArray();
l_IDs TNumberArray := TNumberArray();
tmp_IDs TNumberArray := TNumberArray(null);
tmp_TypeIDs TNumberArray := TNumberArray(null);
cursor c_RegulationProt is
select p.object_id, u.type as object_type_id
from regulation_prot p, units u
where p.id = p_ID AND u.id = p.object_id;
-- more simple than regulation_ascr view
cursor c_Regulations is
SELECT DISTINCT object_id, object_type_id
FROM reg_ascr
WHERE id = p_ID;
begin
DBMS_APPLICATION_INFO.SET_MODULE(G_MODULE_NAME, 'get_icon');
l_Table := upper(p_Table);
if l_Table IN ('PROTS', 'CHEMS', 'UNITS') then
-- Some kind of Units
l_IDs := get_icon_ids(p_ID);
elsif l_Table = 'REACTS' then
-- Reactions
l_IDs := get_icon_ids(p_ID, -1);
elsif l_Table = 'GENES' then
-- Genes
l_IDs := get_icon_ids(p_ID, -2);
elsif l_Table = 'FUNCS' then
-- Enzymes (funxtions)
l_IDs := get_icon_ids(p_ID, -3);
elsif l_Table = 'CLASS' then
-- For this type of p_Table forms Collection of Collections (TSuperNumberArray)
-- First source of object types and IDs
open c_RegulationProt;
fetch c_RegulationProt bulk collect into tmp_IDs, tmp_TypeIDs;
close c_RegulationProt;
if tmp_IDs.count = 0 then
-- Second source of object types and IDs when first source is empty
open c_Regulations;
fetch c_Regulations bulk collect into tmp_IDs, tmp_TypeIDs;
close c_Regulations;
end if;
-- fill arr_IDs with collections of get_icon_ids
if tmp_IDs.count = 0 then
l_IDs := get_icon_ids(p_ID);
arr_IDs.extend;
arr_IDs(1) := l_IDs;
else
arr_IDs.extend(tmp_IDs.count);
for i in 1..tmp_IDs.count loop
l_IDs := get_icon_ids(tmp_IDs(i), tmp_TypeIDs(i));
arr_IDs(i) := l_IDs;
end loop;
end if;
else
sys_error.raise_error(sys_error.UNKNOWN_ICON_TYPE, l_Table);
end if;
l_ID := -1;
-- for 'CLASS' use collection of collections "arr_IDs" insted of single collection "l_IDs"
if l_Table = 'CLASS' then
l_x := arr_IDs.count;
else
l_x := l_IDs.count;
end if;
if l_x = 0 then
l_ID := 3;
elsif l_x = 1 then
l_ID := l_IDs(1);
else
if arr_IDs.count > 0 then
l_IDs := TNumberArray();
-- put in l_IDs only IDs, which exists in all of arrays
-- first, get array with maximum count of elements
l_x := 0;
l_y := 0;
for i in 1..arr_IDs.count loop
if arr_IDs(i).count > l_x then
l_x := arr_IDs(i).count;
l_y := i;
end if;
end loop;
-- now tmp_IDs have maximum of elements
tmp_IDs := arr_IDs(l_y);
-- trying find any elements of tmp_IDs in other arrays
for i in 1..tmp_IDs.count loop
l_flag := true;
for j in 1..arr_ids.count loop
l_flag := l_flag AND (tmp_IDs(i) member of arr_IDs(j));
exit when not l_flag;
end loop;
if l_flag then
l_IDs.extend;
l_IDs(l_IDs.LAST) := tmp_IDs(i);
end if;
end loop;
end if;
if l_IDs.count > 0 then
l_ID := l_IDs(1);
end if;
end if;
if l_ID < 0 then
l_ID := 1;
end if;
DBMS_APPLICATION_INFO.SET_MODULE(null, null);
return l_ID;
end get_icon;And this function call another function as you can see:
function get_icon_ids(
p_ID integer,
p_TypeID integer default null)
return TNumberArray
as
l_TypeID integer;
is_gene integer;
l_IDs TNumberArray := TNumberArray(null);
tmp_IDs TNumberArray := TNumberArray(null);
tmp_Distances TNumberArray := TNumberArray(null);
tmp_Nums TNumberArray;
cursor c_KndUnitIcons(p_TypeID integer) is
select default_icon_id as icon_id, 1000 as dist
from knd_units
where ID = p_TypeID;
cursor c_SelfIcons is
select icon_id, 0 as dist
from proticons
where prot_id = p_ID;
cursor c_UnitIcons is
select distinct i.icon_id, r.dist
from proticons i, unitrelflat r
where r.unitg = i.prot_id and
r.unitm = p_ID and
r.dist >= 0
order by r.dist;
cursor c_IconsG is
select i.icon_id, 0 as dist
from proticons i, geneprot g
where i.prot_id = g.prot and
g.gene = p_ID;
cursor c_IconsG2 is
select i.icon_id, r.dist
from protrelflat r, proticons i, geneprot g
where r.protgrp = i.prot_id and
r.protmbr = g.prot and
r.dist >= 0 and
g.gene = p_ID
order by r.dist;
-- get distances with only icon
-->>>>Spent the most time of execution
cursor c_CountByDist is
select d.dist
from (select rownum as num, column_value as icon_id
from table(tmp_IDs)) i,
(select rownum as num, column_value as dist
from table(tmp_Distances)) d
where i.num = d.num
having count(icon_id) = 1
group by dist
order by dist;
-- found distances for only icons from c_CountByDist
-->>>>Spent the most time of execution
cursor c_IconsByDist is
select i.icon_id
from (select rownum as num, column_value as icon_id
from table(tmp_IDs)) i,
(select rownum as num, column_value as dist
from table(tmp_Distances)) d,
(select column_value as dist
from table(tmp_Nums)) t
where i.num = d.num and
d.dist = t.dist
order by d.dist;
procedure fill_by_default(
p_TypeID integer,
p_DefaultID number default 1)
as
l_ID number;
l_Distance number;
begin
open c_KndUnitIcons(p_TypeID);
fetch c_KndUnitIcons into l_ID, l_Distance;
close c_KndUnitIcons;
tmp_IDs.extend(1);
tmp_IDs(tmp_IDs.count) := nvl(l_ID, p_DefaultID);
tmp_Distances.extend(1);
tmp_Distances(tmp_Distances.count) := nvl(l_Distance, 2000);
end fill_by_default;
procedure fill_for_units(
p_TypeID integer)
as
begin
-- first, find self icon
open c_SelfIcons;
fetch c_SelfIcons bulk collect into tmp_IDs, tmp_Distances;
close c_SelfIcons;
if tmp_IDs.count = 0 then
open c_UnitIcons;
fetch c_UnitIcons bulk collect into tmp_IDs, tmp_Distances;
close c_UnitIcons;
end if;
fill_by_default(p_TypeID);
end fill_for_units;
begin
DBMS_APPLICATION_INFO.SET_MODULE(G_MODULE_NAME, 'get_icon_ids');
l_TypeID := nvl(p_TypeID, unit_service.get_type_id(p_ID));
case l_TypeID
when -2 then
-- for Genes
open c_IconsG;
fetch c_IconsG bulk collect into tmp_IDs, tmp_Distances;
close c_IconsG;
if tmp_IDs.count = 0 then
open c_IconsG2;
fetch c_IconsG2 bulk collect into tmp_IDs, tmp_Distances;
close c_IconsG2;
end if;
if tmp_IDs.count = 0 then
tmp_IDs.extend(1); -- tmp_IDs is null after empty bulk collect
tmp_IDs(1) := 1;
tmp_Distances.extend(1); -- tmp_Distances is null after empty bulk collect
tmp_Distances(1) := 1;
end if;
when -1 then
fill_by_default(l_TypeID);
when -3 then
fill_by_default(l_TypeID);
else
fill_for_units(l_TypeID);
end case;
open c_CountByDist;
fetch c_CountByDist bulk collect into tmp_Nums;
close c_CountByDist;
open c_IconsByDist;
fetch c_IconsByDist bulk collect into l_IDs;
close c_IconsByDist;
if l_IDs.count = 0 then
l_IDs.extend(1);
if p_TypeID = -1 then
l_IDs(1) := 54;
else
l_IDs(1) := 1;
end if;
end if;
DBMS_APPLICATION_INFO.SET_MODULE(null, null);
return l_IDs;
end get_icon_ids;Now, I reviewing the code. Any help is appreciated.
Regards,
Pavel.
Similar Messages
-
Somebody know about dbms_profiler?
Hi.
Do you know something about dbms_profiler?
How do dbms_profiler work?
Do you have some sample or site with documentation?
Regards,
MiltonHi,
Do you know something about dbms_profiler?This package allow create a profile for PL/SQL applications for detect bottlenecks.
How do dbms_profiler work?The DBMS_PROFILES capture all PL/SQL statements and record this information into internal tables and after you can generate reports for analyze the information.
Do you have some sample or site with documentation?You can read the documentation for DBMS_PROFILE directly from Oracle Documentation, look the next link.
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_profil.htm#ARPLS039
Regards. -
Hi,
I want to tune a package. For tuning I am going to use DBMS_PROFILER. But it requires Sys user privilages. But I dont have permissions to use this. Can anyone help me out How to use DBMS_PROFILER.
Why I am using DBMS_PROFILER is, I want to analyze a Program unit execution and determine the runtime behavior.
Please help me out...
Thanks
SateeshHi,
First you must install the DBMS_PROFILER package in your db..... You must connect as sys user... and execute the profload.sql script....
Then you must give the appropriate grant to any db user so as to execute this package ... grant execute on dbms_profiler to scott....
Afterwards , you can connect as user scott for example and execute the sql script "proftab.sql"... and finally you can :
exec dbms_profiler.start_profiler
exec your package
exec dbms_profiler.stop_profiler
Select form the dbms_profiler tables....in scott schema
plsql_profiler_data
plsql_profiler_units
plsql_profiler_runs
Sim -
Need help with DBMS_PROFILER
For some reason the profiler doesn't seem to be working. The user that I am logged in has select/insert/delete on the following profiler tables:
SYS.PLSQL_PROFILER_DATA
SYS.PLSQL_PROFILER_RUNS
SYS.PLSQL_PROFILER_UNITS
I am also able to perform a desc on DBMS_PROFILER, which leads me to believe that I must have execute privilege on it as well. Furthermore, I do not get an error when attempting to execute the DBMS_PROFILER procedures.
However, when I try to run a script that starts, stops, and flushes the profiler, I do not see any data in the profiler tables. Why is this?
example:
DECLARE
v_result BINARY_INTEGER;
v_batch_ind VARCHAR2(1);
BEGIN
v_result := DBMS_PROFILER.start_profiler(run_comment => 'PK_COMMON.F_BATCH_STATUS: '||TRUNC(SYSDATE));
v_batch_ind := PK_COMMON.F_BATCH_STATUS;
v_result := DBMS_PROFILER.stop_profiler;
v_result := dbms_profiler.flush_data;
END;Also, the profiler tables are in the SYS schema, not in the schema of the user that I'm logged in as. Additionally, the DBMS_PROFILER package is under PUBLIC schema. Should these be in my user's schema instead?Somehow it now works.
I installed the "server-side" objects using a wizard in Toad. Now the profiler button in Toad is no longer grayed out, although it still does not toggle the profiling. Instead, I still have to put DBMS_PROFILER.start_profiler and DBMS_PROFILER.stop_profiler in my PL/SQL script. This creates the records in the profiler tables, which I then analyze using the Profiler Analysis in Toad. If the toggle button was working, then I don't think that I would even have to explicity put the calls to DBMS_PROFILER procedures in my code. -
I want to check performance of several pl/sql procedures.
how can i user dbms_profiler for that?
which tables and which columns are important to check performance and statistics?
thanksHope this helps :)
The PL/SQL Code Profiler, the DBMS_PROFILER package
Install the package and supporting elements
Start the profiler
Run your code
Stop the profiler
Analyze the results
Installing the Code Profiler
You will probably have to install the code yourself (in the SYS schema) Check the package specification file for documentation and guidelines
Specification: dbmspbp.sql Body: prvtpbp.plb
Files are located in Rdbms\Admin unless otherwise noted
You must install the profile tables by running the proftab.sql script. Can define them in a shared schema or in separate schemas
Creates three tables:
PLSQL_PROFILER_RUNS: parent table of runs
PLSQL_PROFILER_UNITS: program units executed in run
PLSQL_PROFILER_DATA: profiling data for each line in a program unit
These tables, particularly _DATA, can end up with lots of rows in them
Start the profiler, Run your code and Stop the profiler
BEGIN
DBMS_OUTPUT.PUT_LINE (
DBMS_PROFILER.START_PROFILER (
’showemps ‘ ||
TO_CHAR (SYSDATE, ‘YYYYMMDD HH24:MI:SS’)
showemps;
DBMS_OUTPUT.PUT_LINE (
DBMS_PROFILER.STOP_PROFILER);
END;
Interpreting Code Profiler Results
To make it easier to analyze the data produced by the profiler, Oracle offers the following files in the $ORACLE_HOME\plsql\demo directory:
profrep.sql: Creates a number of views and a package named prof_report_utilities to help extract data from profiling tables
profsum.sql: series of canned queries and programs using prof_report_utilities Don’t run them all; pick the ones that look most useful
update plsql_profiler_units set total_time = 0;
execute prof_report_utilities.rollup_all_runs;
set pagesize 999
set linesize 120
column unit format a20
column line# format 99999
column time_Count format a15
column text format a60
spool slowest2.txt
select
to_char(p1.total_time/10000000, ‘99999999′) || ‘-’ ||
TO_CHAR (p1.total_occur) as time_count,
substr(p2.unit_owner, 1, 20) || ‘.’ ||
decode(p2.unit_name, ‘’, ‘‘,
substr(p2.unit_name,1, 20)) as unit,
TO_CHAR (p1.line#) || ‘-’ || p3.text text
from
plsql_profiler_data p1,
plsql_profiler_units p2,
all_source p3, plsql_profiler_grand_total p4
where
p2.unit_owner NOT IN (’SYS’, ‘SYSTEM’) AND
p1.runID = &&firstparm AND
(p1.total_time >= p4.grand_total/100) AND
p1.runID = p2.runid and
p2.unit_number=p1.unit_number and
p3.type=’PACKAGE BODY’ and
p3.owner = p2.unit_owner and
p3.line = p1.line# and
p3.name=p2.unit_name
order by p1.total_time desc;
spool off
cat slowest2.txt
TIME_COUNT UNIT TEXT
304858-21760 PLG.PLGDOIR 2661- CLOSE alias_cur;
244576-10880 PLG.PLGDOIR 2659- FETCH alias_cur INTO alias_rec;
132498-10881 PLG.PLGDOIR 77- SELECT objid, owner, objname, info, doc
91790-4771 PLG.PLGGEN 3424- v_nth PLS_INTEGER := 1;
70045-27043 PLG.PLGGEN 1014- THEN
69153-79781 PLG.PLGADMIN 447- decrypted_text := decrypted_text ||
58988-4010 PLG.PLGDOIR 450- SELECT just_like
50566-3 PLG.PLGGEN 241- THEN
50404-45983 PLG.PLGSTR 50- RETURN (SUBSTR (string_in, v_start, v_numchar
s));
41622-1 PLG.PLGGEN 2625-
“Best of” Oracle PL/SQL
The most wonderful features of this most wonderful programming language
by Steven Feuerstein -
I am having a minor but nagging problem with a regression in the er_print utility of the Sun Performance Analyzer suite bundled in Studio 12. is there maybe a patch available or in the works?
I have not had any success in finding a resolution by searching the open literature
The issue is that the callers-callees listing only dumps functions in alphabetical order, ignoring the sort order specified by sort. This is a regression from the Performance Analyzer (7.4) behavior from Sun Studio 10. We only recently jumped to studio 12.1.
This functionality is documented here: http://docs.sun.com/app/docs/doc/821-0304/afaid?a=view (as well as many other references). To quote:
callers-callees
Print the callers-callees panel for each of the functions, in the order specified by the function sort metric (sort)."
I use a script input to er_print that in the past analyzed the top N functions sorted on inclusive thread time. Now I have to be sure to dump ALL functions and need a third-party search tool to find that information in the resulting report.
Has anyone heard of this problem or are there Performance Analyzer patch(es) available. I saw some for 7.6 and another for unspecified but have not seen this problem in patch notices.
Thanks.
Regards,
SteveNik, thanks for taking a look. We can't go to 12.2 because we're a software developer and we'll lose our binary compatibility with the release we've been building for the last few months. I'm a systems guy and will paste in a developer's example below.
Note Marc's url shows a 12.1 Performance Analyzer patch 142369-01 we have not yet installed. The patch notice description doesn't show much. I'll pass on patch info to remote user/developer.
Developer example:
I use a script input to er_print that in the past analyzed the top N functions sorted on inclusive thread time. Now I have to be sure to dump ALL functions and need a third-party search tool to find that information in the resulting report.
Heres a shortened (only 4) example of the behavior Im seeing the focus of the functions in callers-callees are NOT those of the functions determined by the sort metric.
= = = =
sysun046% er_print /scratch/test.4.er
/scratch/test.4.er: Experiment has warnings, see header for details
(/opt/sunstudio12.1/bin/../prod/bin/sparcv9/er_print) sort i.total
Current Sort Metric: Inclusive Total Thread Time ( i.total )
(/opt/sunstudio12.1/bin/../prod/bin/sparcv9/er_print) cmetrics a.total:e.user:i.user:e.total:i.total
Current caller-callee metrics: a.total:e.user:i.user:e.total:i.total:name
Current caller-callee sort metric: Attributed Total Thread Time ( a.total )
(/opt/sunstudio12.1/bin/../prod/bin/sparcv9/er_print) limit 4
(/opt/sunstudio12.1/bin/../prod/bin/sparcv9/er_print) sample_select 22-53
Exp Sel Total
=== ===== =====
1 22-53 57
(/opt/sunstudio12.1/bin/../prod/bin/sparcv9/er_print) functions
Functions sorted by metric: Inclusive Total Thread Time
Excl. Incl. Incl. Total Name
User CPU User CPU Thread
sec. sec. sec.
26.015 26.015 113.530 <Total>
0. 26.015 113.530 ACE_Task_Base::svc_run(void*)
0. 26.015 113.530 ACE_Thread_Adapter::invoke()
0. 26.015 113.530 ORB_Task::svc()
(/opt/sunstudio12.1/bin/../prod/bin/sparcv9/er_print) callers-callees
Functions sorted by metric: Inclusive Total Thread Time
Callers and callees sorted by metric: Attributed Total Thread Time
Attr. Total Excl. Incl. Excl. Total Incl. Total Name
Thread User CPU User CPU Thread Thread
sec. sec. sec. sec. sec.
113.530 26.015 26.015 113.530 113.530 *<Total>
113.530 0. 26.015 0. 113.530 lwpstart
Attr. Total Excl. Incl. Excl. Total Incl. Total Name
Thread User CPU User CPU Thread Thread
sec. sec. sec. sec. sec.
0.010 0. 0.010 0. 0.010 ACE_Message_Block::clone(unsigned long)const
0. 0. 0.010 0. 0.010 *ACE_Data_Block::clone(unsigned long)const
0.010 0.398 0.398 0.398 0.398 memcpy
Attr. Total Excl. Incl. Excl. Total Incl. Total Name
Thread User CPU User CPU Thread Thread
sec. sec. sec. sec. sec.
0.001 0. 0.003 0. 0.011 ACE_Select_Reactor_T<ACE_Select_Reactor_Token_T<ACE_Token> >::resume_handler(int)
0.001 0.001 0.001 0.001 0.001 *ACE_Guard<ACE_Select_Reactor_Token_T<ACE_Token> >::release()
Attr. Total Excl. Incl. Excl. Total Incl. Total Name
Thread User CPU User CPU Thread Thread
sec. sec. sec. sec. sec.
0.010 0. 0.010 0. 0.010 TAO_Synch_Queued_Message::clone(ACE_Allocator*)
0. 0. 0.010 0. 0.010 *ACE_Message_Block::clone(unsigned long)const
0.010 0. 0.010 0. 0.010 ACE_Data_Block::clone(unsigned long)const
= = = = =
Nik, thanks for taking a look.
Steve -
Hi
I wonder to know what is the enterprise solution for windows and application event log management and analyzer.
I have recently research and find two application that seems to be profession ,1-manageengine eventlog analyzer, 2- Solarwinds LEM(Solarwind Log & Event Manager).
I Want to know the point of view of Microsoft expert and give me their experience and solutions.
thanks in advance.Consider MS System Center 2012.
Rgds -
Error when starting Bex analyzer
Hi All!
We have a world wide BW-SEM application. In one country they get the following error message when starting Bex analyzer:
<install error> Missing ActiveX component: Business Explorer Global Services
Does anyone have a hint on what to do?
Thanks for your help!
Best Regards
Pontushi
try to check with SAPBEXC.xla
and take a look oss note 585643
may need to manual register .dll with regsvr32
Do an Installation check of the BEx Analyzer as follows:
In the bex analyzer menu, Business explorer -> Installation Check -> Once the excel sheet opens, press the start button to start the check. Check the entries in red to see any missing/old ocx, dlls. -
Analyzer 6.1.1 Not showing all data in 800x600 PC screen settings
I have a user not able to see the whole Analyzer view due to their client pc settings for screen size being set at 800x600. I created the Anazler views with my setting at 1024x768. I need the Analyzer server to make all of the views to be 100% instead of using pixels.
Hi man. Put de border and the proprierts to ajust fit screen. So, when the user open in 800x600, the report will ajust automaticaly in the screen.Regards,Gustavo Santade
-
Satatus of Data in Bex Analyzer
Hello ,
is it possible to hide "status of data" in bex analyzer ? I have read some documents but all are say it is only possible with Web Designer.
I have a query from a Multiprovider and I don't wnt to show Status of data information in the report .
thank you ,
blueYou can goto design mode in the workbook and delete the text element which is showing status of data, come out of design mode and save the workbook.
Edited by: Pravender on May 18, 2010 2:19 PM -
SAP BPC MS 7.5 with Extended Analytic Analyzer and EPM connector
Hi experts,
I need your inputs regarding Extended Analytic Analyzer add ins.
I installed the SAP Business Object Extended Analytic Analyzer hoping to integrate the Xcelsius in SAP BPC MS 7.5
I am following the HTG to integrate but got lost.
In EPM connector steps, I cannot find the option from OPERATION TYPE: Retrieve data using Analyzer Report.
The only options available under operation type are
EPM Report
Retrieve Environments
Retrieve Models
Retrieve Dimensions
Retrieve Dimension Members
Input Data
Retrieve Business Process Flows
Retrieve Context
Retrieve Members Property Values
RetrieveText From Library
It doesn't include the option Retrieve data using Analyzer Report.
Im wondering if there are different version of the epm connector? Was my EPM connector differs from the HTG?
And also in Excel under Extended Analytic Analyzer, the function =GETREPORTDEFINITION() is missing
Please help me on this guys..
Thanks in advance.
yajepeIt seems a very good oportunity to use FIM.
FIM was designed especially for exchange data betweeen different SAP product.
FIM will provide an easy way to do the conversion using wizards and also will assure you about data inetgrity and quality.
This will be the way forward but more details has to be define during the implementation.
I hope this will help you.
Kind Regards
Sorin Radulescu -
"analyze index" vs "rebuild index"
Hi,
I don't undestand the difference between "analyze index" and "rebuild index".
I have a table where I do a lot of "insert" and "update" and "query", What is the best thing to do ??
thanks
GiordanoWhen you use dbms_stats.gather_schema_stats package with cascade=>true option, you are also collecting stats for the indexes, no need to collects stats separately using dbms_stats.gather_index_stats.Of course, but I refered to the rebuild index question. Therefore I only mentioned the GATHER_INDEX_STATS.
Auto_sample_size has many problems/bugs in 9iOk didn't know that - I'm using 10gR2.
But this discussion made me curious. So I tried something (10gR2):
CREATE TABLE BIG NOLOGGING AS
WITH GEN AS (
SELECT ROWNUM ID FROM ALL_OBJECTS WHERE ROWNUM <=10000)
SELECT V1.ID,RPAD('A',10) C FROM GEN V1,GEN V2
WHERE ROWNUM <=10000000;
SELECT COUNT(*) FROM BIG;
COUNT(*)
10000000
So I had a Table containing 10 Million rows. Now I indexed ID:
CREATE INDEX BIG_IDX ON BIG(ID)
I tested two different methods:
1.) GATHER_TABLE_STATS with estimate 10%
EXEC DBMS_STATS.GATHER_TABLE_STATS(TABNAME=>'BIG',OWNNAME=>'DIMITRI',CASCADE=>TRUE,ESTIMATE_PERCENT=>10);
It took about 6 seconds (I only set timing on in sqlplus, no 10046 trace) Now I checked the estimated values:
SELECT NUM_ROWS,SAMPLE_SIZE,ABS(10000000-NUM_ROWS)/100000 VARIANCE,'TABLE' OBJECT FROM USER_TABLES WHERE TABLE_NAME='BIG'
UNION ALL
SELECT NUM_ROWS,SAMPLE_SIZE,ABS(10000000-NUM_ROWS)/100000 VARIANCE,'INDEX' OBJECT FROM USER_INDEXES WHERE INDEX_NAME='BIG_IDX';
NUM_ROWS SAMPLE_SIZE VARIANCE OBJEC
9985220 998522 ,1478 TABLE
9996210 999621 ,0379 INDEX
2.) GATHER_TABLE_STATS with DBMS_STATS.AUTO_SAMPLE_SIZE
EXEC DBMS_STATS.DELETE_TABLE_STATS(OWNNAME=>'DIMITRI',TABNAME=>'BIG');
EXEC DBMS_STATS.GATHER_TABLE_STATS(TABNAME=>'BIG',OWNNAME=>'DIMITRI',CASCADE=>TRUE,ESTIMATE_PERCENT=>DBMS_STATS.AUTO_SAMPLE_SIZE);
It took about 1,5 seconds. Now the results:
NUM_ROWS SAMPLE_SIZE VARIANCE OBJEC
9826851 4715 1,73149 TABLE
10262432 561326 2,62432 INDEX
The estimate 10% was more exact - also a 1,7 and 2,6 percent variance is still ok. It's also very interesting, that using AUTO_SAMPLE_SIZE
causes oracle to execute a estimate 5% for the index and a estimate 0.5 for the table.
I tried again with a table containing only 1 Million records and oracle did an estimate with 100% for the index.
So for me I will continue using AUTO_SAMPLE_SIZE. Its very flexible, fast and accurate.
Dim
PS: Is there a way to format code like one can do in HTML using <code> or <pre>? -
Rebuild index vs Analyze index
Hi All,
I am realy confused about rebuilding index versus Analyzing index.
Could anyone plz help me out what is the diffrence between them.
How to Perform analyze of indexes and Rebuld of Indexes for both Oracle 9i and 10g databases.
Thanks a lotCKPT wrote:
You can see the posts of experts by jonathan
I am realy confused about rebuilding index versus Analyzing index. tell us you are getting confused why we need to ananlyze before reubild index? if so
if index analyzed the whole statistics of index will be gathered.... then you can check what is the hieght of the index.. according to the height of the index you need to take step is index need to be really rebuild or not...
lets see furhter posts from experts if not clear..Thanks OK, so you determine the height of an index is (say) 4. What then ? If you decide to rebuild the index and the index remains at a height of 4, what now ? Was it really worth doing and do you rebuild it again as the index height is still 4 and still within your index rebuild criteria ? At what point do you decide that rebuilding the index just because it has a height of 4 is a total waste of time in this case ?
OK, so you determine the index only has a height of (say) 3, does that mean you don't rebuild the index ? But what if by rebuilding the index, the index now reduces to a height of just 1 ? Perhaps not rebuilding the index even though it has just a height of 3 and doesn't currently meet your index rebuild criteria is totally the wrong thing to do and a rebuild would result in a significantly leaner and more efficient index structure ?
So what if it's pointless rebuilding an index with a height of 4 but another index with a height of 3 is a perfect candidate to be rebuilt ?
Perhaps knowing just the height of an index leaves one totally clueless after all as to whether the index might benefit from an index rebuild ...
Cheers
Richard Foote
http://richardfoote.wordpress.com/ -
Decimal Point in Analyzer 6.2.1
Hi all,Is it possible to set on server Analyzer 6.2.1 the decimal symbol and digit grouping symbol for the format of numbers ?When it has to be done the export to Excel, the number format are taken from Analyzer server. If the Regional Options from the client part for decimal symbol and digit grouping symbol are different from Analyzer server, the export in Excel it does not work properly. Is possible to set the export to Excel to take the number settings from the client part ?
As far as I know this shouldn't be the case. The Java applet should take local client settings period and not be affected by how the server is set. You should ensure that you have the 'international' version of the Sun Java Plugin installed and not the UK/US version. Hope this helps.Paul Armitage.Analitica Ltd.www.analitica.co.uk
-
Long time to start Java Web Client (Analyzer 6.2.1)??
Does anyone know why Analyzer(6.2.1) takes a long time to start Java Web Client. Sometime it's even take more than 5 minutes. I think it is the Java Plug-in starting on the client computer. Any solution?
The key to Analyzer 6.2.1 running correctly is the version of Sun Java Plugin. The ideal version (most optimal) is 1.3.0_02.Secondary to this if Analyzer performs OK once you are logged in then it could be down to the speed of your connection. The applet compiles at runtime (unlike Analyzer 5 which was a one time download). The delay in getting to the login screen could be this download.Hope this helps.Paul ArmitageAnalitica Ltd.www.analitica.co.uk
Maybe you are looking for
-
New computer. Trying to install itunes however keep getting a message claiming I do not have VBScript,or it is turned off and or needs to be reinstalled. I am not able to locate this on my system nor have I been able to download it. I do have Quick T
-
Can't send multiple photos in MMS
If I select a photo and choose to send via MMS then tap the camera icon next to the photo on the MMS screen (in order to choose an additional photo to send), the app sends me back to the Home screen. Also tried this on my 3GS running iOS4 and the sam
-
After upgrading, font in google is FAT and UGLY
*blocked by the greatwall, google hongkong-ing so after upgrading to Mountain Lion, I've tried to search around and learnt a new term called font conflict, I'm not sure if it is a font conflict, however, I truly can't bear with seeing this ugly and f
-
Message delivery noticification problem after 60.0...
hi, i recently updated to 60.0.003 even with the warning tones "off", i get the msg delivery report with the msg tone. the screen flashes with the delivery report and it also rings with the msg tone. this wasnt a prob b4 the update. anybody else has
-
Hi, I have the following setup that i am tasked with creating static nat for and i am a little lost with getting the correct nat working. Here is the setup: Internal servers behind firewall 192.168.1.0/24 Firewall external interface is 192.168.5.36 F