EXPLAIN PLAN option disabled
Hi,
When I take an Explain Plan using TKPROF it gives the following error:
Error in CREATE TABLE of EXPLAIN PLAN table: APPS.prof$plan_table
ORA-00955: name is already used by an existing object
parse error offset: 18
EXPLAIN PLAN option disabled.
And the Explain Plan is snot displayed in the o/p file for all the queries.
Can any one help me on this.
Thanks,
Kiran
Hi kiran
When I take an Explain Plan using TKPROF it gives the following error:
Error in CREATE TABLE of EXPLAIN PLAN table: APPS.prof$plan_table
ORA-00955: name is already used by an existing object
parse error offset: 18
EXPLAIN PLAN option disabled.
********************************************************************************What is your Db verssion and EBS? What is your kprof syntax. By the way please check those doc adn see its helpful:
Run Adadmin To Recreate Grants And Synonyms ORA-20000 ORA-00955 In Synonyms Loop:create_synonym(GL,PLAN_TABLE,APPS,PLAN_TABLE) [ID 437714.1]
TKPROF With Explain Fails With ORA-00903 invalid table name [ID 257294.1]
OERR: ORA 955 is already used by an existing object [ID 18549.1]
Also check:
Re: TKPROF and Explain Plan
Regard
Helios
Similar Messages
-
Explain Plan is disabled - why?
Hi
I was using SqlDeveloper 1.0 and had no problems using the Explain Plan feature. Now I upgraded to 1.1 (did not migrate settings) and now the explain plan button is always greyed out. Am I missing something to enable the explain plan feature?
ThanksAre all the buttons grayed out on the worksheet or just the explain plan button? If you look at your worksheet, is the drop list on the right hand side populated? i.e does it display your user connection? If not, select your connection in the drop kist and the icons will change from gray to available.
You say in your message that you upgraded to 1.1. I assume you did a fresh install in a new directory.
Regards
Sue -
"Execute Explain Plan" button disabled
I'm using the 1.1.3 version of SQL Developer included in the Oracle 11g distribution for Windows.
After connecting to a database and executing a query, I am unable to view its execution plan because the explain plan button is greyed-out. The connected user has the PLAN_TABLE table in its schema.Are all the buttons grayed out on the worksheet or just the explain plan button? If you look at your worksheet, is the drop list on the right hand side populated? i.e does it display your user connection? If not, select your connection in the drop kist and the icons will change from gray to available.
You say in your message that you upgraded to 1.1. I assume you did a fresh install in a new directory.
Regards
Sue -
Over all a very nice product. As with everything now it is difficult to place the raptor feature set in the over all product set. However any comparison is inevitable.
It would be nice if the explain plan option would ask for a default userid in case the table names are not fully qualified. This is how OEM works. It is a very convenient feature.Say I get a sql from somewhere for explain plan. The sql is executed as user scott.
When I paste the sql in the worksheet(logged in as system) and ask for an explain plan - raptor will complain about table or view not existing (942)
If I do the same in OEM (9I). OEM will ask for a default parsing userid. You pick scott and all tables in the sql are automatically aliased as scott and out comes the explain plan.
Also is there option in raptor to pretty format an sql (Again similar to OEM) -
How can i paste the explain plan from toad..
Hello all
I tried taking a snap of the explain plan from toad but in this forum the paste option is disabled...please help964145 wrote:
I tried taking a snap of the explain plan from toad but in this forum the paste option is disabled...please helpI don't know, but it is a waste of time since explain plans from Toad are not useful.
Please read the forum FAQ on providing information for a tuning request, it describes how to generate an explain plan that can be shared.
{message:id=9360003}
This is an example.
SQL> explain plan for
2 select * from dual;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3543395131
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 |
-------------------------------------------------------------------------- -
Cpu time is not getting displayed in explain plan
Hi All,
I am trying to analyze one query using explain plan .like below
1) explain plan for
SELECT /*+ parallel(tsp,8) use_hash( tsp tp) */ count(1)
FROM router tp,
receiver tsp
WHERE tp.rs = tsp.rp
AND creater_date >=to_date('04032009000000','ddmmyyyyhh24miss')
and tsp.XVF is not null
and tp.XVF is not null
and tp.role_name='BR';
2)@$ORACLE_HOME/rdbms/admin/utlxpls.sql
But i am getting only following columns in result .
| Id | Operation | Name | Rows | Bytes | Cost |
No Cpu time preset .
How can i extimate CPU time ?
Pls help
Thanksam_73798 wrote:
I am trying to analyze one query using explain plan .like below
But i am getting only following columns in result .
| Id | Operation | Name | Rows | Bytes | Cost |
No Cpu time preset .
How can i extimate CPU time ?You need to mention your database version (4-digits, e.g. 9.2.0.8).
In Oracle 9i CPU costing is disabled by default, you need to gather WORKLOAD system statistics to enable the CPU costing.
In 10g CPU costing is enabled by default and uses default NOWORKLOAD system statistics if no WORKLOAD system statistics have been gathered. It can only be disabled by setting an undocumented parameter or by changing the OPTIMIZER_FEATURES_ENABLE parameter back to 9i compatibility.
You can check the status of your system statistics by running the following query in SQL*Plus:
column sname format a20
column pname format a20
column pval2 format a20
select
sname
, pname
, pval1
, pval2
from
sys.aux_stats$;Can you show us the actual (complete) output you get from "utlxpls.sql"? Use the \ tag to preserve formatting here:
\output
\will show asoutput
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Performance problem: Query explain plan changes in pl/sql vs. literal args
I have a complex query with 5+ table joins on large (million+ row) tables. In it's most simplified form, it's essentially
select * from largeTable large
join anotherLargeTable anothr on (anothr.id_2 = large.pk_id)
join...(other aux tables)
where large.pk_id between 123 and 456;
Its performance was excellent with literal arguments (1 sec per execution).
But, when I used pl/sql bind argument variables instead of 123 and 456 as literals, the explain plan changes drastically, and runs 10+ minutes.
Ex:
CREATE PROCEDURE runQuery(param1 INTEGER, param2 INTEGER){
CURSOR LT_CURSOR IS
select * from largeTable large
join anotherLargeTable anothr on (anothr.id_2 = large.pk_id)
join...(other aux tables)
where large.pk_id between param1 AND param2;
BEGIN
FOR aRecord IN LT_CURSOR
LOOP
(print timestamp...)
END LOOP;
END runQuery;
Rewriting the query 5 different ways was unfruitful. DB hints were also unfruitful in this particular case. LargeTable.pk_id was an indexed field as were all other join fields.
Solution:
Lacking other options, I wrote a literal query that concatenated the variable args. Open a cursor for the literal query.
Upside: It changed the explain plan to the only really fast option and performed at 1 second instead of 10mins.
Downside: Query not cached for future use. Perfectly fine for this query's purpose.
Other suggestions are welcome.AmandaSoosai wrote:
I have a complex query with 5+ table joins on large (million+ row) tables. In it's most simplified form, it's essentially
select * from largeTable large
join anotherLargeTable anothr on (anothr.id_2 = large.pk_id)
join...(other aux tables)
where large.pk_id between 123 and 456;
Its performance was excellent with literal arguments (1 sec per execution).
But, when I used pl/sql bind argument variables instead of 123 and 456 as literals, the explain plan changes drastically, and runs 10+ minutes.
Ex:
CREATE PROCEDURE runQuery(param1 INTEGER, param2 INTEGER){
CURSOR LT_CURSOR IS
select * from largeTable large
join anotherLargeTable anothr on (anothr.id_2 = large.pk_id)
join...(other aux tables)
where large.pk_id between param1 AND param2;
BEGIN
FOR aRecord IN LT_CURSOR
LOOP
(print timestamp...)
END LOOP;
END runQuery;
Rewriting the query 5 different ways was unfruitful. DB hints were also unfruitful in this particular case. LargeTable.pk_id was an indexed field as were all other join fields.
Solution:
Lacking other options, I wrote a literal query that concatenated the variable args. Open a cursor for the literal query.
Upside: It changed the explain plan to the only really fast option and performed at 1 second instead of 10mins.
Downside: Query not cached for future use. Perfectly fine for this query's purpose.
Other suggestions are welcome.Best wild guess based on what you've posted is a bind variable mismatch (your column is declared as a NUMBER data type and your bind variable is declared as a VARCHAR for example). Unless you have histograms on the columns in question ... which, if you're using bind variables is usually a really bad idea.
A basic illustration of my guess
http://blogs.oracle.com/optimizer/entry/how_do_i_get_sql_executed_from_an_application_to_uses_the_same_execution_plan_i_get_from_sqlplus -
Same query, same dataset, same ddl setup, but wildly different explain plan
Hello o fountains of oracle knowledge!
We have a problem that caused us a full stop when rolling out a new version of our system to a customer and a whole Sunday to boot.
The scenario is as follows:
1. An previous version database schema
2. The current version database schema
3. A migration script to migrate the old schema to the new
So we perform the following migration:
1. Export the previous version database schema
2. Import into a new schema called schema_old
3. Create a new schema called schema_new
4. Run migration script which creates objects, copies data, creates indexes etc etc in schema_new
The migration runs fine in all environments (development, test and production)
In our development and test environments performance is stellar, on the customer production server the performance is terrible.
This using the exact same export file (from the production environment) and performing the exact same steps with the exact same migration script.
Database version is 10.2.0.1.0 EE on all databases. OS is Microsoft Windows Server 2003 EE SP2 on all servers.
The system is not in any sense under a heavy load (we have tested with no other load than ourselves).
Looking at the explain plan for a query that is run frequently and does not use bind variables we see wildly different explain plans.
The explain plan cost on our development and test servers is estimated to *7* for this query and there are no full table scans.
On the production server the cost is *8433* and there are two full table scans of which one is on the largest table.
We have tried to run analyse on all objects with very little effect. The plan changed very slightly, but still includes the two full table scans on the problem server and the cost is still the same.
All tables and indexes are identical (including storage options), created from the same migration script.
I am currently at loss for where to look? What can be causing this? I assume this could be caused by some parameter that is set on the server, but I don't know what to look for.
I would be very grateful for any pointers.
Thanks,
HåkonThank you for your answer.
We collected statistics only after we determined that the production server where not behaving according to expectations.
In this case we used TOAD and the tool within to collect statistics for all objects. We used 'Analyze' and 'Compute Statistics' options.
I am not an expert, so sorry if this is too naive an approach.
Here is the query:SELECT count(0)
FROM score_result sr, web_scorecard sc, product p
WHERE sr.score_final_decision like 'VENT%'
AND sc.CREDIT_APPLICATION_ID = sr.CREDIT_APPLICATION_ID
AND sc.application_complete='Y'
AND p.product = sc.web_product
AND p.inactive_product = '2' ;I use this as an example, but the problem exists for virtually all queries.
The output from the 'good' server:
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 1 | 39 | 7 (0)|
| 1 | SORT AGGREGATE | | 1 | 39 | |
| 2 | NESTED LOOPS | | 1 | 39 | 7 (0)|
| 3 | NESTED LOOPS | | 1 | 30 | 6 (0)|
| 4 | TABLE ACCESS BY INDEX ROWID| SCORE_RESULT | 1 | 17 | 4 (0)|
| 5 | INDEX RANGE SCAN | SR_FINAL_DECISION_IDX | 1 | | 3 (0)|
| 6 | TABLE ACCESS BY INDEX ROWID| WEB_SCORECARD | 1 | 13 | 2 (0)|
| 7 | INDEX UNIQUE SCAN | WEB_SCORECARD_PK | 1 | | 1 (0)|
| 8 | TABLE ACCESS BY INDEX ROWID | PRODUCT | 1 | 9 | 1 (0)|
| 9 | INDEX UNIQUE SCAN | PK_PRODUCT | 1 | | 0 (0)|
---------------------------------------------------------------------------------------------The output from the 'bad' server:
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 1 | 32 | 8344 (3)|
| 1 | SORT AGGREGATE | | 1 | 32 | |
| 2 | HASH JOIN | | 10887 | 340K| 8344 (3)|
| 3 | TABLE ACCESS FULL | PRODUCT | 6 | 42 | 3 (0)|
| 4 | HASH JOIN | | 34381 | 839K| 8340 (3)|
| 5 | VIEW | index$_join$_001 | 34381 | 503K| 2193 (3)|
| 6 | HASH JOIN | | | | |
| 7 | INDEX RANGE SCAN | SR_FINAL_DECISION_IDX | 34381 | 503K| 280 (3)|
| 8 | INDEX FAST FULL SCAN| SCORE_RESULT_PK | 34381 | 503K| 1371 (2)|
| 9 | TABLE ACCESS FULL | WEB_SCORECARD | 489K| 4782K| 6137 (4)|
----------------------------------------------------------------------------------------I hope the formatting makes this readable.
Stats (from SQL Developer), good table:NUM_ROWS 489716
BLOCKS 27198
AVG_ROW_LEN 312
SAMPLE_SIZE 489716
LAST_ANALYZED 15.12.2009
LAST_ANALYZED_SINCE 15.12.2009Stats (from SQL Developer), bad table:
NUM_ROWS 489716
BLOCKS 27199
AVG_ROW_LEN 395
SAMPLE_SIZE 489716
LAST_ANALYZED 17.12.2009
LAST_ANALYZED_SINCE 17.12.2009I'm unsure what would cause the difference in average row length.
I could obviously try to tune our sql-statements to work on the server not behaving better, but I would rather understand why they are different and make sure that we can expect similar behaviour between environments.
Thank you again for trying to help me.
Håkon
Edited by: ergates on 17.des.2009 05:57
Edited by: ergates on 17.des.2009 06:02 -
Explain Plan in Pl/SQL developer tool
How to get the explain plan result of a query in PL/SQL developer tool which has a database link ?
Also, please suggest the min and max Cost, Cardinality and byte values
Thanks859486 wrote:
How to get the explain plan result of a query in PL/SQL developer tool which has a database link ?PL/SQL Developer is a tool written by allround automations.
I suggest you ask how to use that tool vie the support option on their own website/forums:
http://www.allroundautomations.com/plsqldev.html
Also, please suggest the min and max Cost, Cardinality and byte valuesmin cost would be 0
max cost could be anything
cardinality is http://en.wikipedia.org/wiki/Cardinality_%28SQL_statements%29
bytes are the number of estimated bytes involved in the data retrieved/processed. -
Explain plan result for a long-running query used in data-warehousing. Tuni
I have executed an explain plan for a query that is used in a data-warehousing application.
This sql is taking too long to execute as it is visiting 24 partitions.
Where each partition contains data for 1 month month, so it fetches last 2 year data.
And each partition has a million or so rows.
All this is kept in table prescrip_retail. So this table has 24 partitions.
abc@def>explain plan set statement_id='dwh_query'
2 for
3 SELECT r.pier_account_id,
4 p.presc_num,
5 spm.product_id,
6 p.month,
7 t.best_call_state,
8 sum(p.trx_count)
9 FROM rlup_assigned_account r,
10 temp_presc_num_TEST t,
11 retail.prescrip_retail p,
12 sherlock.sherlock_product_mapping spm
13 WHERE spm.product_id like '056%'
14 and t.CLIENT_ID='934759'
15 and p.month >= add_months(sysdate,-24)
16 and spm.mds6 = p.product_id
17 and t.CLIENT_ID = p.presc_num
18 and r.ndc_pyr_id = p.payer_plan
19 and t.best_call_state = r.ST
20 GROUP BY r.pier_account_id,
21 p.presc_num,
22 spm.product_id,
23 p.month,
24 t.best_call_state;
Explained.
abc@def>ed
Wrote file afiedt.buf
1 select operation,options,optimizer,cost,cardinality,partition_start,partition_stop
2 from plan_table
3* where statement_id='dwh_query'
abc@def>/
OPERATION OPTIONS OPTIMIZER COST CARDINALITY
PARTITION_START
PARTITION_STOP
SELECT STATEMENT CHOOSE 850 1
SORT GROUP BY 850 1
NESTED LOOPS 848 1
HASH JOIN 845 3
HASH JOIN 842 6
TABLE ACCESS FULL ANALYZED 1 6
PARTITION RANGE ITERATOR
KEY
36
TABLE ACCESS BY LOCAL INDEX ROWID ANALYZED 839 166
KEY
36
BITMAP CONVERSION TO ROWIDS
BITMAP INDEX SINGLE VALUE
KEY
36
TABLE ACCESS FULL 2 50
TABLE ACCESS BY INDEX ROWID ANALYZED 1 149501
INDEX UNIQUE SCAN ANALYZED 149501
13 rows selected.Here is the create statement for PRESCRIP_RETAIL table:
I have observed 2 things:
1. In the query the following joins are present.
13 WHERE spm.product_id like '056%'
14 and t.CLIENT_ID='934759'
15 and p.month >= add_months(sysdate,-24)
16 and spm.mds6 = p.product_id
17 and t.CLIENT_ID = p.presc_num
18 and r.ndc_pyr_id = p.payer_plan
19 and t.best_call_state = r.ST
Index exist for p.product_id,p.presc_num,p.payer_plan as you can see below.
However, the index does not exist for month.
I am also doing search for month.
I feel if I create a "partitioned index" on month, query performance should improve.
Q Can you provide me the syntax for creating a partitioned index on month?
2.The following tables are used in the query:
9 FROM rlup_assigned_account r,
10 temp_presc_num_TEST t,
11 retail.prescrip_retail p,
12 sherlock.sherlock_product_mapping spm
In these tables, apart from sherlock.sherlock_product_mapping table the statistics that exist is old.
I need to analyse on table level as well as column level.
For example:
Table prescrip_retail is analyzed in 2002,
table temp_presc_num_TEST is not analysed at all.
table rlup_assigned_account is analysed in Feb 2007.
sherlock_product_mapping is the only table that has updated statistics, analysed on Oct. 2007
Here is the table creation statement of PRESCRIP_RETAIL and index on it.
Prompt Table PRESCRIP_RETAIL;
-- PRESCRIP_RETAIL (Table)
-- Row count:2806673860
CREATE TABLE RETAIL.PRESCRIP_RETAIL
PRESC_NUM NUMBER,
PIER_NUM CHAR(8),
RELID CHAR(9) NOT NULL,
ME_NUM CHAR(10) NOT NULL,
PRODUCT_ID CHAR(6) NOT NULL,
PRODUCT_FRMSTR CHAR(1) NOT NULL,
PAYER_PLAN CHAR(6) NOT NULL,
MONTH DATE NOT NULL,
PYMT_CODE CHAR(1) NOT NULL,
NRX_COUNT NUMBER(7) NOT NULL,
NRX_QUANTITY NUMBER(9) NOT NULL,
NRX_DOLLARS NUMBER(13,2) NOT NULL,
TRX_COUNT NUMBER(7) NOT NULL,
TRX_QUANTITY NUMBER(9) NOT NULL,
TRX_DOLLARS NUMBER(13,2) NOT NULL
TABLESPACE PRESC_PARTITION_29
NOLOGGING
PARTITION BY RANGE (MONTH)
PARTITION PRESC200406 VALUES LESS THAN (TO_DATE(' 2004-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_30,
PARTITION PRESC200407 VALUES LESS THAN (TO_DATE(' 2004-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_31,
PARTITION PRESC200408 VALUES LESS THAN (TO_DATE(' 2004-09-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_32,
PARTITION PRESC200409 VALUES LESS THAN (TO_DATE(' 2004-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_33,
PARTITION PRESC200410 VALUES LESS THAN (TO_DATE(' 2004-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_34,
PARTITION PRESC200411 VALUES LESS THAN (TO_DATE(' 2004-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_35,
PARTITION PRESC200412 VALUES LESS THAN (TO_DATE(' 2005-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_36,
PARTITION PRESC200501 VALUES LESS THAN (TO_DATE(' 2005-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_01,
PARTITION PRESC200502 VALUES LESS THAN (TO_DATE(' 2005-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_02,
PARTITION PRESC200503 VALUES LESS THAN (TO_DATE(' 2005-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_03,
PARTITION PRESC200504 VALUES LESS THAN (TO_DATE(' 2005-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_04,
PARTITION PRESC200505 VALUES LESS THAN (TO_DATE(' 2005-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_05,
PARTITION PRESC200506 VALUES LESS THAN (TO_DATE(' 2005-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_06,
PARTITION PRESC200507 VALUES LESS THAN (TO_DATE(' 2005-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_07,
PARTITION PRESC200508 VALUES LESS THAN (TO_DATE(' 2005-09-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_08,
PARTITION PRESC200509 VALUES LESS THAN (TO_DATE(' 2005-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_09,
PARTITION PRESC200510 VALUES LESS THAN (TO_DATE(' 2005-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_10,
PARTITION PRESC200511 VALUES LESS THAN (TO_DATE(' 2005-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_11,
PARTITION PRESC200512 VALUES LESS THAN (TO_DATE(' 2006-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_12,
PARTITION PRESC200601 VALUES LESS THAN (TO_DATE(' 2006-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_13,
PARTITION PRESC200602 VALUES LESS THAN (TO_DATE(' 2006-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_14,
PARTITION PRESC200603 VALUES LESS THAN (TO_DATE(' 2006-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_15,
PARTITION PRESC200604 VALUES LESS THAN (TO_DATE(' 2006-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_16,
PARTITION PRESC200605 VALUES LESS THAN (TO_DATE(' 2006-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_17,
PARTITION PRESC200606 VALUES LESS THAN (TO_DATE(' 2006-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_18,
PARTITION PRESC200607 VALUES LESS THAN (TO_DATE(' 2006-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_19,
PARTITION PRESC200608 VALUES LESS THAN (TO_DATE(' 2006-09-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_20,
PARTITION PRESC200609 VALUES LESS THAN (TO_DATE(' 2006-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_21,
PARTITION PRESC200610 VALUES LESS THAN (TO_DATE(' 2006-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_22,
PARTITION PRESC200611 VALUES LESS THAN (TO_DATE(' 2006-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_23,
PARTITION PRESC200612 VALUES LESS THAN (TO_DATE(' 2007-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_24,
PARTITION PRESC200701 VALUES LESS THAN (TO_DATE(' 2007-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_25,
PARTITION PRESC200702 VALUES LESS THAN (TO_DATE(' 2007-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_26,
PARTITION PRESC200703 VALUES LESS THAN (TO_DATE(' 2007-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_27,
PARTITION PRESC200704 VALUES LESS THAN (TO_DATE(' 2007-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_28,
PARTITION PRESC200705 VALUES LESS THAN (TO_DATE(' 2007-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
TABLESPACE PRESC_PARTITION_29
NOCACHE
NOPARALLEL;
Prompt Index BX2_PRESC_PAYER;
-- BX2_PRESC_PAYER (Index)
-- Dependencies:
-- PRESCRIP_RETAIL (Table)
CREATE BITMAP INDEX RETAIL.BX2_PRESC_PAYER ON RETAIL.PRESCRIP_RETAIL
(PAYER_PLAN)
TABLESPACE PRESC_PARTITION_29
LOGGING
LOCAL (
PARTITION PRESC200406
NOLOGGING
TABLESPACE PRESC_PARTITION_30,
PARTITION PRESC200407
NOLOGGING
TABLESPACE PRESC_PARTITION_31,
PARTITION PRESC200408
NOLOGGING
TABLESPACE PRESC_PARTITION_32,
PARTITION PRESC200409
NOLOGGING
TABLESPACE PRESC_PARTITION_33,
PARTITION PRESC200410
NOLOGGING
TABLESPACE PRESC_PARTITION_34,
PARTITION PRESC200411
NOLOGGING
TABLESPACE PRESC_PARTITION_35,
PARTITION PRESC200412
NOLOGGING
TABLESPACE PRESC_PARTITION_36,
PARTITION PRESC200501
NOLOGGING
TABLESPACE PRESC_PARTITION_01,
PARTITION PRESC200502
NOLOGGING
TABLESPACE PRESC_PARTITION_02,
PARTITION PRESC200503
NOLOGGING
TABLESPACE PRESC_PARTITION_03,
PARTITION PRESC200504
NOLOGGING
TABLESPACE PRESC_PARTITION_04,
PARTITION PRESC200505
NOLOGGING
TABLESPACE PRESC_PARTITION_05,
PARTITION PRESC200506
NOLOGGING
TABLESPACE PRESC_PARTITION_06,
PARTITION PRESC200507
NOLOGGING
TABLESPACE PRESC_PARTITION_07,
PARTITION PRESC200508
NOLOGGING
TABLESPACE PRESC_PARTITION_08,
PARTITION PRESC200509
NOLOGGING
TABLESPACE PRESC_PARTITION_09,
PARTITION PRESC200510
NOLOGGING
TABLESPACE PRESC_PARTITION_10,
PARTITION PRESC200511
NOLOGGING
TABLESPACE PRESC_PARTITION_11,
PARTITION PRESC200512
NOLOGGING
TABLESPACE PRESC_PARTITION_12,
PARTITION PRESC200601
NOLOGGING
TABLESPACE PRESC_PARTITION_13,
PARTITION PRESC200602
NOLOGGING
TABLESPACE PRESC_PARTITION_14,
PARTITION PRESC200603
NOLOGGING
TABLESPACE PRESC_PARTITION_15,
PARTITION PRESC200604
NOLOGGING
TABLESPACE PRESC_PARTITION_16,
PARTITION PRESC200605
NOLOGGING
TABLESPACE PRESC_PARTITION_17,
PARTITION PRESC200606
NOLOGGING
TABLESPACE PRESC_PARTITION_18,
PARTITION PRESC200607
NOLOGGING
TABLESPACE PRESC_PARTITION_19,
PARTITION PRESC200608
NOLOGGING
TABLESPACE PRESC_PARTITION_20,
PARTITION PRESC200609
NOLOGGING
TABLESPACE PRESC_PARTITION_21,
PARTITION PRESC200610
NOLOGGING
TABLESPACE PRESC_PARTITION_22,
PARTITION PRESC200611
NOLOGGING
TABLESPACE PRESC_PARTITION_23,
PARTITION PRESC200612
NOLOGGING
TABLESPACE PRESC_PARTITION_24,
PARTITION PRESC200701
NOLOGGING
TABLESPACE PRESC_PARTITION_25,
PARTITION PRESC200702
NOLOGGING
TABLESPACE PRESC_PARTITION_26,
PARTITION PRESC200703
NOLOGGING
TABLESPACE PRESC_PARTITION_27,
PARTITION PRESC200704
NOLOGGING
TABLESPACE PRESC_PARTITION_28,
PARTITION PRESC200705
NOLOGGING
TABLESPACE PRESC_PARTITION_29
NOPARALLEL;
Prompt Index BX3_PRESC_PAYERCD;
-- BX3_PRESC_PAYERCD (Index)
-- Dependencies:
-- PRESCRIP_RETAIL (Table)
CREATE BITMAP INDEX RETAIL.BX3_PRESC_PAYERCD ON RETAIL.PRESCRIP_RETAIL
(PYMT_CODE)
TABLESPACE PRESC_PARTITION_29
NOLOGGING
LOCAL (
PARTITION PRESC200406
NOLOGGING
TABLESPACE PRESC_PARTITION_30,
PARTITION PRESC200407
NOLOGGING
TABLESPACE PRESC_PARTITION_31,
PARTITION PRESC200408
NOLOGGING
TABLESPACE PRESC_PARTITION_32,
PARTITION PRESC200409
NOLOGGING
TABLESPACE PRESC_PARTITION_33,
PARTITION PRESC200410
NOLOGGING
TABLESPACE PRESC_PARTITION_34,
PARTITION PRESC200411
NOLOGGING
TABLESPACE PRESC_PARTITION_35,
PARTITION PRESC200412
NOLOGGING
TABLESPACE PRESC_PARTITION_36,
PARTITION PRESC200501
NOLOGGING
TABLESPACE PRESC_PARTITION_01,
PARTITION PRESC200502
NOLOGGING
TABLESPACE PRESC_PARTITION_02,
PARTITION PRESC200503
NOLOGGING
TABLESPACE PRESC_PARTITION_03,
PARTITION PRESC200504
NOLOGGING
TABLESPACE PRESC_PARTITION_04,
PARTITION PRESC200505
NOLOGGING
TABLESPACE PRESC_PARTITION_05,
PARTITION PRESC200506
NOLOGGING
TABLESPACE PRESC_PARTITION_06,
PARTITION PRESC200507
NOLOGGING
TABLESPACE PRESC_PARTITION_07,
PARTITION PRESC200508
NOLOGGING
TABLESPACE PRESC_PARTITION_08,
PARTITION PRESC200509
NOLOGGING
TABLESPACE PRESC_PARTITION_09,
PARTITION PRESC200510
NOLOGGING
TABLESPACE PRESC_PARTITION_10,
PARTITION PRESC200511
NOLOGGING
TABLESPACE PRESC_PARTITION_11,
PARTITION PRESC200512
NOLOGGING
TABLESPACE PRESC_PARTITION_12,
PARTITION PRESC200601
NOLOGGING
TABLESPACE PRESC_PARTITION_13,
PARTITION PRESC200602
NOLOGGING
TABLESPACE PRESC_PARTITION_14,
PARTITION PRESC200603
NOLOGGING
TABLESPACE PRESC_PARTITION_15,
PARTITION PRESC200604
NOLOGGING
TABLESPACE PRESC_PARTITION_16,
PARTITION PRESC200605
NOLOGGING
TABLESPACE PRESC_PARTITION_17,
PARTITION PRESC200606
NOLOGGING
TABLESPACE PRESC_PARTITION_18,
PARTITION PRESC200607
NOLOGGING
TABLESPACE PRESC_PARTITION_19,
PARTITION PRESC200608
NOLOGGING
TABLESPACE PRESC_PARTITION_20,
PARTITION PRESC200609
NOLOGGING
TABLESPACE PRESC_PARTITION_21,
PARTITION PRESC200610
NOLOGGING
TABLESPACE PRESC_PARTITION_22,
PARTITION PRESC200611
NOLOGGING
TABLESPACE PRESC_PARTITION_23,
PARTITION PRESC200612
NOLOGGING
TABLESPACE PRESC_PARTITION_24,
PARTITION PRESC200701
NOLOGGING
TABLESPACE PRESC_PARTITION_25,
PARTITION PRESC200702
NOLOGGING
TABLESPACE PRESC_PARTITION_26,
PARTITION PRESC200703
NOLOGGING
TABLESPACE PRESC_PARTITION_27,
PARTITION PRESC200704
NOLOGGING
TABLESPACE PRESC_PARTITION_28,
PARTITION PRESC200705
NOLOGGING
TABLESPACE PRESC_PARTITION_29
NOPARALLEL;
Prompt Index BX4_PRESC_PRESC;
-- BX4_PRESC_PRESC (Index)
-- Dependencies:
-- PRESCRIP_RETAIL (Table)
CREATE BITMAP INDEX RETAIL.BX4_PRESC_PRESC ON RETAIL.PRESCRIP_RETAIL
(PRESC_NUM)
TABLESPACE PRESC_PARTITION_29
NOLOGGING
LOCAL (
PARTITION PRESC200406
NOLOGGING
TABLESPACE PRESC_PARTITION_30,
PARTITION PRESC200407
NOLOGGING
TABLESPACE PRESC_PARTITION_31,
PARTITION PRESC200408
NOLOGGING
TABLESPACE PRESC_PARTITION_32,
PARTITION PRESC200409
NOLOGGING
TABLESPACE PRESC_PARTITION_33,
PARTITION PRESC200410
NOLOGGING
TABLESPACE PRESC_PARTITION_34,
PARTITION PRESC200411
NOLOGGING
TABLESPACE PRESC_PARTITION_35,
PARTITION PRESC200412
NOLOGGING
TABLESPACE PRESC_PARTITION_36,
PARTITION PRESC200501
NOLOGGING
TABLESPACE PRESC_PARTITION_01,
PARTITION PRESC200502
NOLOGGING
TABLESPACE PRESC_PARTITION_02,
PARTITION PRESC200503
NOLOGGING
TABLESPACE PRESC_PARTITION_03,
PARTITION PRESC200504
NOLOGGING
TABLESPACE PRESC_PARTITION_04,
PARTITION PRESC200505
NOLOGGING
TABLESPACE PRESC_PARTITION_05,
PARTITION PRESC200506
NOLOGGING
TABLESPACE PRESC_PARTITION_06,
PARTITION PRESC200507
NOLOGGING
TABLESPACE PRESC_PARTITION_07,
PARTITION PRESC200508
NOLOGGING
TABLESPACE PRESC_PARTITION_08,
PARTITION PRESC200509
NOLOGGING
TABLESPACE PRESC_PARTITION_09,
PARTITION PRESC200510
NOLOGGING
TABLESPACE PRESC_PARTITION_10,
PARTITION PRESC200511
NOLOGGING
TABLESPACE PRESC_PARTITION_11,
PARTITION PRESC200512
NOLOGGING
TABLESPACE PRESC_PARTITION_12,
PARTITION PRESC200601
NOLOGGING
TABLESPACE PRESC_PARTITION_13,
PARTITION PRESC200602
NOLOGGING
TABLESPACE PRESC_PARTITION_14,
PARTITION PRESC200603
NOLOGGING
TABLESPACE PRESC_PARTITION_15,
PARTITION PRESC200604
NOLOGGING
TABLESPACE PRESC_PARTITION_16,
PARTITION PRESC200605
NOLOGGING
TABLESPACE PRESC_PARTITION_17,
PARTITION PRESC200606
NOLOGGING
TABLESPACE PRESC_PARTITION_18,
PARTITION PRESC200607
NOLOGGING
TABLESPACE PRESC_PARTITION_19,
PARTITION PRESC200608
NOLOGGING
TABLESPACE PRESC_PARTITION_20,
PARTITION PRESC200609
NOLOGGING
TABLESPACE PRESC_PARTITION_21,
PARTITION PRESC200610
NOLOGGING
TABLESPACE PRESC_PARTITION_22,
PARTITION PRESC200611
NOLOGGING
TABLESPACE PRESC_PARTITION_23,
PARTITION PRESC200612
NOLOGGING
TABLESPACE PRESC_PARTITION_24,
PARTITION PRESC200701
NOLOGGING
TABLESPACE PRESC_PARTITION_25,
PARTITION PRESC200702
NOLOGGING
TABLESPACE PRESC_PARTITION_26,
PARTITION PRESC200703
NOLOGGING
TABLESPACE PRESC_PARTITION_27,
PARTITION PRESC200704
NOLOGGING
TABLESPACE PRESC_PARTITION_28,
PARTITION PRESC200705
NOLOGGING
TABLESPACE PRESC_PARTITION_29
NOPARALLEL;
Prompt Index BX5_PRESC_PIER;
-- BX5_PRESC_PIER (Index)
-- Dependencies:
-- PRESCRIP_RETAIL (Table)
CREATE BITMAP INDEX RETAIL.BX5_PRESC_PIER ON RETAIL.PRESCRIP_RETAIL
(PIZR_NUM)
TABLESPACE PRESC_PARTITION_29
LOGGING
LOCAL (
PARTITION PRESC200406
NOLOGGING
TABLESPACE PRESC_PARTITION_30,
PARTITION PRESC200407
NOLOGGING
TABLESPACE PRESC_PARTITION_31,
PARTITION PRESC200408
NOLOGGING
TABLESPACE PRESC_PARTITION_32,
PARTITION PRESC200409
NOLOGGING
TABLESPACE PRESC_PARTITION_33,
PARTITION PRESC200410
NOLOGGING
TABLESPACE PRESC_PARTITION_34,
PARTITION PRESC200411
NOLOGGING
TABLESPACE PRESC_PARTITION_35,
PARTITION PRESC200412
NOLOGGING
TABLESPACE PRESC_PARTITION_36,
PARTITION PRESC200501
NOLOGGING
TABLESPACE PRESC_PARTITION_01,
PARTITION PRESC200502
NOLOGGING
TABLESPACE PRESC_PARTITION_02,
PARTITION PRESC200503
NOLOGGING
TABLESPACE PRESC_PARTITION_03,
PARTITION PRESC200504
NOLOGGING
TABLESPACE PRESC_PARTITION_04,
PARTITION PRESC200505
NOLOGGING
TABLESPACE PRESC_PARTITION_05,
PARTITION PRESC200506
NOLOGGING
TABLESPACE PRESC_PARTITION_06,
PARTITION PRESC200507
NOLOGGING
TABLESPACE PRESC_PARTITION_07,
PARTITION PRESC200508
NOLOGGING
TABLESPACE PRESC_PARTITION_08,
PARTITION PRESC200509
NOLOGGING
TABLESPACE PRESC_PARTITION_09,
PARTITION PRESC200510
NOLOGGING
TABLESPACE PRESC_PARTITION_10,
PARTITION PRESC200511
NOLOGGING
TABLESPACE PRESC_PARTITION_11,
PARTITION PRESC200512
NOLOGGING
TABLESPACE PRESC_PARTITION_12,
PARTITION PRESC200601
NOLOGGING
TABLESPACE PRESC_PARTITION_13,
PARTITION PRESC200602
NOLOGGING
TABLESPACE PRESC_PARTITION_14,
PARTITION PRESC200603
NOLOGGING
TABLESPACE PRESC_PARTITION_15,
PARTITION PRESC200604
NOLOGGING
TABLESPACE PRESC_PARTITION_16,
PARTITION PRESC200605
NOLOGGING
TABLESPACE PRESC_PARTITION_17,
PARTITION PRESC200606
NOLOGGING
TABLESPACE PRESC_PARTITION_18,
PARTITION PRESC200607
NOLOGGING
TABLESPACE PRESC_PARTITION_19,
PARTITION PRESC200608
NOLOGGING
TABLESPACE PRESC_PARTITION_20,
PARTITION PRESC200609
NOLOGGING
TABLESPACE PRESC_PARTITION_21,
PARTITION PRESC200610
NOLOGGING
TABLESPACE PRESC_PARTITION_22,
PARTITION PRESC200611
NOLOGGING
TABLESPACE PRESC_PARTITION_23,
PARTITION PRESC200612
NOLOGGING
TABLESPACE PRESC_PARTITION_24,
PARTITION PRESC200701
NOLOGGING
TABLESPACE PRESC_PARTITION_25,
PARTITION PRESC200702
NOLOGGING
TABLESPACE PRESC_PARTITION_26,
PARTITION PRESC200703
NOLOGGING
TABLESPACE PRESC_PARTITION_27,
PARTITION PRESC200704
NOLOGGING
TABLESPACE PRESC_PARTITION_28,
PARTITION PRESC200705
NOLOGGING
TABLESPACE PRESC_PARTITION_29
NOPARALLEL;
Prompt Index BX6_PRESC_RELID;
-- BX6_PRESC_RELID (Index)
-- Dependencies:
-- PRESCRIP_RETAIL (Table)
CREATE BITMAP INDEX RETAIL.BX6_PRESC_RELID ON RETAIL.PRESCRIP_RETAIL
(RELID)
TABLESPACE PRESC_PARTITION_29
LOGGING
LOCAL (
PARTITION PRESC200406
NOLOGGING
TABLESPACE PRESC_PARTITION_30,
PARTITION PRESC200407
NOLOGGING
TABLESPACE PRESC_PARTITION_31,
PARTITION PRESC200408
NOLOGGING
TABLESPACE PRESC_PARTITION_32,
PARTITION PRESC200409
NOLOGGING
TABLESPACE PRESC_PARTITION_33,
PARTITION PRESC200410
NOLOGGING
TABLESPACE PRESC_PARTITION_34,
PARTITION PRESC200411
NOLOGGING
TABLESPACE PRESC_PARTITION_35,
PARTITION PRESC200412
NOLOGGING
TABLESPACE PRESC_PARTITION_36,
PARTITION PRESC200501
NOLOGGING
TABLESPACE PRESC_PARTITION_01,
PARTITION PRESC200502
NOLOGGING
TABLESPACE PRESC_PARTITION_02,
PARTITION PRESC200503
NOLOGGING
TABLESPACE PRESC_PARTITION_03,
PARTITION PRESC200504
NOLOGGING
TABLESPACE PRESC_PARTITION_04,
PARTITION PRESC200505
NOLOGGING
TABLESPACE PRESC_PARTITION_05,
PARTITION PRESC200506
NOLOGGING
TABLESPACE PRESC_PARTITION_06,
PARTITION PRESC200507
NOLOGGING
TABLESPACE PRESC_PARTITION_07,
PARTITION PRESC200508
NOLOGGING
TABLESPACE PRESC_PARTITION_08,
PARTITION PRESC200509
NOLOGGING
TABLESPACE PRESC_PARTITION_09,
PARTITION PRESC200510
NOLOGGING
TABLESPACE PRESC_PARTITION_10,
PARTITION PRESC200511
NOLOGGING
TABLESPACE PRESC_PARTITION_11,
PARTITION PRESC200512
NOLOGGING
TABLESPACE PRESC_PARTITION_12,
PARTITION PRESC200601
NOLOGGING
TABLESPACE PRESC_PARTITION_13,
PARTITION PRESC200602
NOLOGGING
TABLESPACE PRESC_PARTITION_14,
PARTITION PRESC200603
NOLOGGING
TABLESPACE PRESC_PARTITION_15,
PARTITION PRESC200604
NOLOGGING
TABLESPACE PRESC_PARTITION_16,
PARTITION PRESC200605
NOLOGGING
TABLESPACE PRESC_PARTITION_17,
PARTITION PRESC200606
NOLOGGING
TABLESPACE PRESC_PARTITION_18,
PARTITION PRESC200607
NOLOGGING
TABLESPACE PRESC_PARTITION_19,
PARTITION PRESC200608
NOLOGGING
TABLESPACE PRESC_PARTITION_20,
PARTITION PRESC200609
NOLOGGING
TABLESPACE PRESC_PARTITION_21,
PARTITION PRESC200610
NOLOGGING
TABLESPACE PRESC_PARTITION_22,
PARTITION PRESC200611
NOLOGGING
TABLESPACE PRESC_PARTITION_23,
PARTITION PRESC200612
NOLOGGING
TABLESPACE PRESC_PARTITION_24,
PARTITION PRESC200701
NOLOGGING
TABLESPACE PRESC_PARTITION_25,
PARTITION PRESC200702
NOLOGGING
TABLESPACE PRESC_PARTITION_26,
PARTITION PRESC200703
NOLOGGING
TABLESPACE PRESC_PARTITION_27,
PARTITION PRESC200704
NOLOGGING
TABLESPACE PRESC_PARTITION_28,
PARTITION PRESC200705
NOLOGGING
TABLESPACE PRESC_PARTITION_29
NOPARALLEL;
Prompt Index BX7_PRESC_ME;
-- BX7_PRESC_ME (Index)
-- Dependencies:
-- PRESCRIP_RETAIL (Table)
CREATE BITMAP INDEX RETAIL.BX7_PRESC_ME ON RETAIL.PRESCRIP_RETAIL
(ME_NUM)
TABLESPACE PRESC_PARTITION_29
LOGGING
LOCAL (
PARTITION PRESC200406
NOLOGGING
TABLESPACE PRESC_PARTITION_30,
PARTITION PRESC200407
NOLOGGING
TABLESPACE PRESC_PARTITION_31,
PARTITION PRESC200408
NOLOGGING
TABLESPACE PRESC_PARTITION_32,
PARTITION PRESC200409
NOLOGGING
TABLESPACE PRESC_PARTITION_33,
PARTITION PRESC200410
NOLOGGING
TABLESPACE PRESC_PARTITION_34,
PARTITION PRESC200411
NOLOGGING
TABLESPACE PRESC_PARTITION_35,
PARTITION PRESC200412
NOLOGGING
TABLESPACE PRESC_PARTITION_36,
PARTITION PRESC200501
NOLOGGING
TABLESPACE PRESC_PARTITION_01,
PARTITION PRESC200502
NOLOGGING
TABLESPACE PRESC_PARTITION_02,
PARTITION PRESC200503
NOLOGGING
TABLESPACE PRESC_PARTITION_03,
PARTITION PRESC200504
NOLOGGING
TABLESPACE PRESC_PARTITION_04,
PARTITION PRESC200505
NOLOGGING
TABLESPACE PRESC_PARTITION_05,
PARTITION PRESC200506
NOLOGGING
TABLESPACE PRESC_PARTITION_06,
PARTITION PRESC200507
NOLOGGING
TABLESPACE PRESC_PARTITION_07,
PARTITION PRESC200508
NOLOGGING
TABLESPACE PRESC_PARTITION_08,
PARTITION PRESC200509
NOLOGGING
TABLESPACE PRESC_PARTITION_09,
PARTITION PRESC200510
NOLOGGING
TABLESPACE PRESC_PARTITION_10,
PARTITION PRESC200511
NOLOGGING
TABLESPACE PRESC_PARTITION_11,
PARTITION PRESC200512
NOLOGGING
TABLESPACE PRESC_PARTITION_12,
PARTITION PRESC200601
NOLOGGING
TABLESPACE PRESC_PARTITION_13,
PARTITION PRESC200602
NOLOGGING
TABLESPACE PRESC_PARTITION_14,
PARTITION PRESC200603
NOLOGGING
TABLESPACE PRESC_PARTITION_15,
PARTITION PRESC200604
NOLOGGING
TABLESPACE PRESC_PARTITION_16,
PARTITION PRESC200605
NOLOGGING
TABLESPACE PRESC_PARTITION_17,
PARTITION PRESC200606
NOLOGGING
TABLESPACE PRESC_PARTITION_18,
PARTITION PRESC200607
NOLOGGING
TABLESPACE PRESC_PARTITION_19,
PARTITION PRESC200608
NOLOGGING
TABLESPACE PRESC_PARTITION_20,
PARTITION PRESC200609
NOLOGGING
TABLESPACE PRESC_PARTITION_21,
PARTITION PRESC200610
NOLOGGING
TABLESPACE PRESC_PARTITION_22,
PARTITION PRESC200611
NOLOGGING
TABLESPACE PRESC_PARTITION_23,
PARTITION PRESC200612
NOLOGGING
TABLESPACE PRESC_PARTITION_24,
PARTITION PRESC200701
NOLOGGING
TABLESPACE PRESC_PARTITION_25,
PARTITION PRESC200702
NOLOGGING
TABLESPACE PRESC_PARTITION_26,
PARTITION PRESC200703
NOLOGGING
TABLESPACE PRESC_PARTITION_27,
PARTITION PRESC200704
NOLOGGING
TABLESPACE PRESC_PARTITION_28,
PARTITION PRESC200705
NOLOGGING
TABLESPACE PRESC_PARTITION_29
NOPARALLEL;
Prompt Index BX1_PRESC_PROD;
-- BX1_PRESC_PROD (Index)
-- Dependencies:
-- PRESCRIP_RETAIL (Table)
CREATE BITMAP INDEX RETAIL.BX1_PRESC_PROD ON RETAIL.PRESCRIP_RETAIL
(PRODUCT_ID, PRODUCT_FRMSTR)
TABLESPACE PRESC_PARTITION_29
LOGGING
LOCAL (
PARTITION PRESC200406
NOLOGGING
TABLESPACE PRESC_PARTITION_30,
PARTITION PRESC200407
NOLOGGING
TABLESPACE PRESC_PARTITION_31,
PARTITION PRESC200408
NOLOGGING
TABLESPACE PRESC_PARTITION_32,
PARTITION PRESC200409
NOLOGGING
TABLESPACE PRESC_PARTITION_33,
PARTITION PRESC200410
NOLOGGING
TABLESPACE PRESC_PARTITION_34,
PARTITION PRESC200411
NOLOGGING
TABLESPACE PRESC_PARTITION_35,
PARTITION PRESC200412
NOLOGGING
TABLESPACE PRESC_PARTITION_36,
PARTITION PRESC200501
NOLOGGING
TABLESPACE PRESC_PARTITION_01,
PARTITION PRESC200502
NOLOGGING
TABLESPACE PRESC_PARTITION_02,
PARTITION PRESC200503
NOLOGGING
TABLESPACE PRESC_PARTITION_03,
PARTITION PRESC200504
NOLOGGING
TABLESPACE PRESC_PARTITION_04,
PARTITION PRESC200505
NOLOGGING
TABLESPACE PRESC_PARTITION_05,
PARTITION PRESC200506
NOLOGGING
TABLESPACE PRESC_PARTITION_06,
PARTITION PRESC200507
NOLOGGING
TABLESPACE PRESC_PARTITION_07,
PARTITION PRESC200508
NOLOGGING
TABLESPACE PRESC_PARTITION_08,
PARTITION PRESC200509
NOLOGGING
TABLESPACE PRESC_PARTITION_09,
PARTITION PRESC200510
NOLOGGING
TABLESPACE PRESC_PARTITION_10,
PARTITION PRESC200511
NOLOGGING
TABLESPACE PRESC_PARTITION_11,
PARTITION PRESC200512
NOLOGGING
TABLESPACE PRESC_PARTITION_12,
PARTITION PRESC200601
NOLOGGING
TABLESPACE PRESC_PARTITION_13,
PARTITION PRESC200602
NOLOGGING
TABLESPACE PRESC_PARTITION_14,
PARTITION PRESC200603
NOLOGGING
TABLESPACE PRESC_PARTITION_15,
PARTITION PRESC200604
NOLOGGING
TABLESPACE PRESC_PARTITION_16,
PARTITION PRESC200605
NOLOGGING
TABLESPACE PRESC_PARTITION_17,
PARTITION PRESC200606
NOLOGGING
TABLESPACE PRESC_PARTITION_18,
PARTITION PRESC200607
NOLOGGING
TABLESPACE PRESC_PARTITION_19,
PARTITION PRESC200608
NOLOGGING
TABLESPACE PRESC_PARTITION_20,
PARTITION PRESC200609
NOLOGGING
TABLESPACE PRESC_PARTITION_21,
PARTITION PRESC200610
NOLOGGING
TABLESPACE PRESC_PARTITION_22,
PARTITION PRESC200611
NOLOGGING
TABLESPACE PRESC_PARTITION_23,
PARTITION PRESC200612
NOLOGGING
TABLESPACE PRESC_PARTITION_24,
PARTITION PRESC200701
NOLOGGING
TABLESPACE PRESC_PARTITION_25,
PARTITION PRESC200702
NOLOGGING
TABLESPACE PRESC_PARTITION_26,
PARTITION PRESC200703
NOLOGGING
TABLESPACE PRESC_PARTITION_27,
PARTITION PRESC200704
NOLOGGING
TABLESPACE PRESC_PARTITION_28,
PARTITION PRESC200705
NOLOGGING
TABLESPACE PRESC_PARTITION_29
NOPARALLEL; -
Oracle not using its own explain plan
When I run a simple select query on an indexed column on a large (30 million records) table oracle creates a plan using the indexed column and at a cost of 4. However, what it actually does is do a table scan (I can see this in the 'Long Operations' tab in OEM).
The funny thing is that I have the same query in a ADO application and when the query is run from there, the same plan is created but no table scan is done - and the query returns in less than a second. However, with the table scan it is over a minute.
When run through SQL plus Oracle creates a plan including the table scan at a cost of 19030.
In another (dot net) application I used the: "Alter session set optimizer_index_caching=100" and "Alter session set optimizer_index_cost_adj=10" to try to force the optimizer to use the index. It creates the expected plan, but still does the table scan.
The query is in the form of:
"Select * from tab where indexedcol = something"
Im using Oracle 9i 9.2.0.1.0
Any ideas as I'm completely at a loss?Hello
It sounds to me like this has something to do with bind variable peeking which was introduced in 9i. If the predicate is
indexedcolumn = :bind_variablethe first time the query is parsed by oracle, it will "peek" at the value in the bind variable and see what it is and will generate an execution plan based on this. That same plan will be used for matching SQL.
If you use a litteral, it will generate the plan based on that, and will generate a separate plan for each litteral you use (depending on the value of the cursor_sharing initialisation parameter).
This can cause there to be a difference between the execution plan seen when issuing EXPLAIN PLAN FOR, and the actual exectuion plan used when the query is run.
Have a look at the following example:
tylerd@DEV2> CREATE TABLE dt_test_bvpeek(id number, col1 number)
2 /
Table created.
Elapsed: 00:00:00.14
tylerd@DEV2> INSERT
2 INTO
3 dt_test_bvpeek
4 SELECT
5 rownum,
6 CASE
7 WHEN MOD(rownum, 5) IN (0,1,2,3) THEN
8 1
9 ELSE
10 MOD(rownum, 5)
11 END
12 END
13 FROM
14 dual
15 CONNECT BY
16 LEVEL <= 100000
17 /
100000 rows created.
Elapsed: 00:00:00.81
tylerd@DEV2> select count(*), col1 from dt_test_bvpeek group by col1
2 /
COUNT(*) COL1
80000 1
20000 4
2 rows selected.
Elapsed: 00:00:00.09
tylerd@DEV2> CREATE INDEX dt_test_bvpeek_i1 ON dt_test_bvpeek(col1)
2 /
Index created.
Elapsed: 00:00:00.40
tylerd@DEV2> EXEC dbms_stats.gather_table_stats( ownname=>USER,-
tabname=>'DT_TEST_BVPEEK',-
method_opt=>'FOR ALL INDEXED COLUMNS SIZE 254',-
cascade=>TRUE -
);PL/SQL procedure successfully completed.
Elapsed: 00:00:00.73
tylerd@DEV2> EXPLAIN PLAN FOR
2 SELECT
3 *
4 FROM
5 dt_test_bvpeek
6 WHERE
7 col1 = 1
8 /
Explained.
Elapsed: 00:00:00.01
tylerd@DEV2> SELECT * FROM TABLE(DBMS_XPLAN.display)
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 2611346395
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 78728 | 538K| 82 (52)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| DT_TEST_BVPEEK | 78728 | 538K| 82 (52)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter("COL1"=1)
13 rows selected.
Elapsed: 00:00:00.06The execution plan for col1=1 was chosen because oracle was able to see that based on the statistics, col1=1 would result in most of the rows from the table being returned.
tylerd@DEV2> EXPLAIN PLAN FOR
2 SELECT
3 *
4 FROM
5 dt_test_bvpeek
6 WHERE
7 col1 = 4
8 /
Explained.
Elapsed: 00:00:00.00
tylerd@DEV2> SELECT * FROM TABLE(DBMS_XPLAN.display)
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 3223879139
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 21027 | 143K| 74 (21)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| DT_TEST_BVPEEK | 21027 | 143K| 74 (21)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | DT_TEST_BVPEEK_I1 | 21077 | | 29 (28)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("COL1"=4)
14 rows selected.
Elapsed: 00:00:00.04This time, the optimiser was able to see that col1=4 would result in far fewer rows so it chose to use an index. Look what happens however when we use a bind variable with EXPLAIN PLAN FOR - especially the number of rows the optimiser estimates to be returned from the table
tylerd@DEV2> var an_col1 NUMBER
tylerd@DEV2> exec :an_col1:=1;
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
tylerd@DEV2>
tylerd@DEV2> EXPLAIN PLAN FOR
2 SELECT
3 *
4 FROM
5 dt_test_bvpeek
6 WHERE
7 col1 = :an_col1
8 /
Explained.
Elapsed: 00:00:00.01
tylerd@DEV2> SELECT * FROM TABLE(DBMS_XPLAN.display)
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 2611346395
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 49882 | 340K| 100 (60)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| DT_TEST_BVPEEK | 49882 | 340K| 100 (60)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter("COL1"=TO_NUMBER(:AN_COL1))
13 rows selected.
Elapsed: 00:00:00.04
tylerd@DEV2>
tylerd@DEV2> exec :an_col1:=4;
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.01
tylerd@DEV2>
tylerd@DEV2> EXPLAIN PLAN FOR
2 SELECT
3 *
4 FROM
5 dt_test_bvpeek
6 WHERE
7 col1 = :an_col1
8 /
Explained.
Elapsed: 00:00:00.01
tylerd@DEV2> SELECT * FROM TABLE(DBMS_XPLAN.display)
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 2611346395
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 49882 | 340K| 100 (60)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| DT_TEST_BVPEEK | 49882 | 340K| 100 (60)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter("COL1"=TO_NUMBER(:AN_COL1))
13 rows selected.
Elapsed: 00:00:00.07For both values of the bind variable, the optimiser has no idea what the value will be so it has to make a calculation based on a formula which results in it estimating that the query will return roughly half of the rows in the table, and so it chooses a full scan.
Now when we actually run the query, the optimiser can take advantage of bind variable peeking and have a look at the value the first time round and base the execution plan on that:
tylerd@DEV2> exec :an_col1:=1;
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
tylerd@DEV2> SELECT
2 *
3 FROM
4 dt_test_bvpeek
5 WHERE
6 col1 = :an_col1
7 /
80000 rows selected.
Elapsed: 00:00:10.98
tylerd@DEV2> SELECT prev_sql_id FROM v$session WHERE audsid=SYS_CONTEXT('USERENV','SESSIONID')
2 /
PREV_SQL_ID
9t52uyyq67211
1 row selected.
Elapsed: 00:00:00.00
tylerd@DEV2> SELECT
2 operation,
3 options,
4 object_name
5 FROM
6 v$sql_plan
7 WHERE
8 sql_id = '9t52uyyq67211'
9 /
OPERATION OPTIONS OBJECT_NAME
SELECT STATEMENT
TABLE ACCESS FULL DT_TEST_BVPEEK
2 rows selected.
Elapsed: 00:00:00.03It saw that the bind variable value was 1 and that this would return most of the rows in the table so it chose a full scan.
tylerd@DEV2> exec :an_col1:=4
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
tylerd@DEV2> SELECT
2 *
3 FROM
4 dt_test_bvpeek
5 WHERE
6 col1 = :an_col1
7 /
20000 rows selected.
Elapsed: 00:00:03.50
tylerd@DEV2> SELECT prev_sql_id FROM v$session WHERE audsid=SYS_CONTEXT('USERENV','SESSIONID')
2 /
PREV_SQL_ID
9t52uyyq67211
1 row selected.
Elapsed: 00:00:00.00
tylerd@DEV2> SELECT
2 operation,
3 options,
4 object_name
5 FROM
6 v$sql_plan
7 WHERE
8 sql_id = '9t52uyyq67211'
9 /
OPERATION OPTIONS OBJECT_NAME
SELECT STATEMENT
TABLE ACCESS FULL DT_TEST_BVPEEK
2 rows selected.
Elapsed: 00:00:00.01Even though the value of the bind variable changed, the optimiser saw that it already had a cached version of the sql statement along with an execution plan, so it used that rather than regenerating the plan. We can check the reverse of this by causing the statement to be invalidated and re-parsed - there's lots of ways, but I'm just going to rename the table:
Elapsed: 00:00:00.03
tylerd@DEV2> alter table dt_test_bvpeek rename to dt_test_bvpeek1
2 /
Table altered.
Elapsed: 00:00:00.01
tylerd@DEV2>
20000 rows selected.
Elapsed: 00:00:04.81
tylerd@DEV2> SELECT prev_sql_id FROM v$session WHERE audsid=SYS_CONTEXT('USERENV','SESSIONID')
2 /
PREV_SQL_ID
6ztnn4fyt6y5h
1 row selected.
Elapsed: 00:00:00.00
tylerd@DEV2> SELECT
2 operation,
3 options,
4 object_name
5 FROM
6 v$sql_plan
7 WHERE
8 sql_id = '6ztnn4fyt6y5h'
9 /
OPERATION OPTIONS OBJECT_NAME
SELECT STATEMENT
TABLE ACCESS BY INDEX ROWID DT_TEST_BVPEEK1
INDEX RANGE SCAN DT_TEST_BVPEEK_I1
3 rows selected.
80000 rows selected.
Elapsed: 00:00:10.61
tylerd@DEV2> SELECT prev_sql_id FROM v$session WHERE audsid=SYS_CONTEXT('USERENV','SESSIONID')
2 /
PREV_SQL_ID
6ztnn4fyt6y5h
1 row selected.
Elapsed: 00:00:00.01
tylerd@DEV2> SELECT
2 operation,
3 options,
4 object_name
5 FROM
6 v$sql_plan
7 WHERE
8 sql_id = '6ztnn4fyt6y5h'
9 /
OPERATION OPTIONS OBJECT_NAME
SELECT STATEMENT
TABLE ACCESS BY INDEX ROWID DT_TEST_BVPEEK1
INDEX RANGE SCAN DT_TEST_BVPEEK_I1
3 rows selected.This time round, the optimiser peeked at the bind variable the first time the statement was exectued and found it to be 4, so it based the execution plan on that and chose an index range scan. When the statement was executed again, it used the plan it had already executed.
HTH
David -
"Explain Plan" in Oracle SQL Developer is greyed out
Hi all,
I know this is not the right place to post this, but I have look around and do not know where to post question about Oracle SQL Developer - I presume this tool is also discussed here in this forum.
My question is very simple (I presume):
1. I installed Oracle SQL Developer 3.0.04.
2. I added a new DB connection to a DB hosted in one of my servers in the LAN.
3. However, when I am writing some SQL queries, I intend to use the "Explain Plan" feature, but it is being greyed out (disabled).
4. How can I enable it back?Hello,
{forum:id=260}
Regards
Marcus -
Hi,
I am quite new to use explain plan in oracle.
I want to know what are the important factors that we should emphasize to optimize a SQL query.
Thanks in Advance,
DilipIf I had to identify key SQL tuning factors to look for in relation to an explain plan I would say that number one is to verify that the plan is driving on the right tables in the proper order.
Second looking at the SQL make sure it is not written in such a manner as to disable the use of available indexes such as when a trunc is done on an indexed date column so it can be compared equal to another date when a >= date value of midnight and < midnight of first day not desired could be used instead enabling use of the index on the date column by the optimizer. Implicit conversions of join column data types can also disable use of an index.
Third, if the CBO is doing something other than what you expected do not just assume it is wrong. Try to figure out why it is doing what it is doing and then try to determine if it is right or wrong. I have caught people trying to tune SQL because they knew the plan was wrong, but did not actually test it before spending a lot of time to develop a different path that ran slower than the optimzer plan.
HTH -- Mark D Powell -- -
DECODE is changing the explain plan
I have a statement with a decode function in the where clause like this:
AND decode(:cropcode,-1,'-1',sdu.u_crop_group) = decode(:cropcode,-1,'-1',:cropcode)When I a pass -1 as parameter for cropgroup the filter would result in "AND '-1' = '-1' and the statement is executed in less than 2 seconds. When I leave out this where clause it takes almost 18 seconds. The result is the same so I don't understand why the explain plan is so much different and why not using index scans in the statement without decode.
Below the explain plans and tkprofs for 1 (without decode) and 2 (with decode).
*explain 1*
{code}
SQL Statement which produced this data:
select * from table(dbms_xplan.display)
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
| 0 | SELECT STATEMENT | | 7080 | 2413K| | 43611 (2)|
| 1 | SORT ORDER BY | | 7080 | 2413K| 5224K| 43611 (2)|
|* 2 | FILTER | | | | | |
|* 3 | HASH JOIN | | 7156 | 2438K| | 43075 (2)|
| 4 | TABLE ACCESS FULL | DWH_ABS_DETERMINATION | 17745 | 363K| | 83 (0)|
|* 5 | HASH JOIN OUTER | | 7156 | 2292K| | 42991 (2)|
|* 6 | HASH JOIN | | 7156 | 1355K| | 42907 (2)|
|* 7 | HASH JOIN | | 6987 | 1187K| | 19170 (2)|
|* 8 | HASH JOIN | | 6947 | 963K| | 10376 (1)|
|* 9 | TABLE ACCESS BY INDEX ROWID | ALIQUOT | 3 | 144 | | 3 (0)|
| 10 | NESTED LOOPS | | 6907 | 897K| | 8577 (1)|
|* 11 | HASH JOIN | | 2264 | 187K| | 1782 (2)|
| 12 | TABLE ACCESS BY INDEX ROWID | SAMPLE | 190 | 4370 | | 17 (0)|
| 13 | NESTED LOOPS | | 2264 | 152K| | 107 (1)|
| 14 | NESTED LOOPS | | 12 | 552 | | 25 (0)|
|* 15 | TABLE ACCESS FULL | SDG_USER | 12 | 288 | | 13 (0)|
| 16 | TABLE ACCESS BY INDEX ROWID| SDG | 1 | 22 | | 1 (0)|
|* 17 | INDEX UNIQUE SCAN | PK_SDG | 1 | | | 0 (0)|
|* 18 | INDEX RANGE SCAN | FK_SAMPLE_SDG | 597 | | | 2 (0)|
| 19 | TABLE ACCESS FULL | SAMPLE_USER | 1078K| 16M| | 1669 (1)|
|* 20 | INDEX RANGE SCAN | FK_ALIQUOT_SAMPLE | 3 | | | 2 (0)|
| 21 | TABLE ACCESS FULL | ALIQUOT_USER | 3403K| 29M| | 1781 (3)|
| 22 | TABLE ACCESS FULL | TEST | 3423K| 104M| | 8775 (2)|
|* 23 | TABLE ACCESS FULL | RESULT | 3435K| 65M| | 23718 (2)|
| 24 | VIEW | PLATE | 21787 | 2851K| | 84 (2)|
|* 25 | FILTER | | | | | |
| 26 | TABLE ACCESS FULL | PLATE | 21787 | 574K| | 84 (2)|
|* 27 | INDEX UNIQUE SCAN | PK_OPERATOR_GROUP | 1 | 7 | | 0 (0)|
|* 28 | INDEX UNIQUE SCAN | PK_OPERATOR_GROUP | 1 | 7 | | 0 (0)|
|* 29 | INDEX UNIQUE SCAN | PK_OPERATOR_GROUP | 1 | 7 | | 0 (0)|
|* 30 | INDEX UNIQUE SCAN | PK_OPERATOR_GROUP | 1 | 7 | | 0 (0)|
|* 31 | INDEX UNIQUE SCAN | PK_OPERATOR_GROUP | 1 | 7 | | 0 (0)|
Predicate Information (identified by operation id):
2 - filter(("GROUP_ID" IS NULL OR EXISTS (SELECT /*+ */ 0 FROM "LIMS"."OPERATOR_GROUP"
"OPERATOR_GROUP" WHERE "OPERATOR_ID"="LIMS$OPERATOR_ID"() AND "GROUP_ID"=:B1)) AND ("GROUP_ID" IS NULL
OR EXISTS (SELECT /*+ */ 0 FROM "LIMS"."OPERATOR_GROUP" "OPERATOR_GROUP" WHERE
"OPERATOR_ID"="LIMS$OPERATOR_ID"() AND "GROUP_ID"=:B2)) AND ("GROUP_ID" IS NULL OR EXISTS (SELECT /*+
*/ 0 FROM "LIMS"."OPERATOR_GROUP" "OPERATOR_GROUP" WHERE "OPERATOR_ID"="LIMS$OPERATOR_ID"() AND
"GROUP_ID"=:B3)) AND ("GROUP_ID" IS NULL OR EXISTS (SELECT /*+ */ 0 FROM "LIMS"."OPERATOR_GROUP"
"OPERATOR_GROUP" WHERE "OPERATOR_ID"="LIMS$OPERATOR_ID"() AND "GROUP_ID"=:B4)))
3 - access("U_ABS_DETERMINATION"="DETERMINATION_ASSIGNMENT")
5 - access("PLT"."PLATE_ID"(+)="PLATE_ID")
6 - access("TEST_ID"="TEST_ID")
7 - access("ALIQUOT_ID"="ALIQUOT_ID")
8 - access("ALIQUOT_ID"="ALIQUOT_ID")
9 - filter("STATUS"='C' OR "STATUS"='P' OR "STATUS"='V')
11 - access("SAMPLE_ID"="SAMPLE_ID")
15 - filter("U_ABS_DETERMINATION" IS NOT NULL AND "U_CLIENT_TYPE"='QC' AND
"U_WEEK_OF_PROCESSING"=TO_NUMBER(:WEEK) AND "U_YEAR_OF_SAMPLE_DELIVERY"=TO_NUMBER(:YEAR))
17 - access("SDG_ID"="SDG_ID")
18 - access("SDG_ID"="SDG_ID")
20 - access("SAMPLE_ID"="SAMPLE_ID")
23 - filter("NAME"='End result')
25 - filter("GROUP_ID" IS NULL OR EXISTS (SELECT /*+ */ 0 FROM "LIMS"."OPERATOR_GROUP"
"OPERATOR_GROUP" WHERE "OPERATOR_ID"="LIMS$OPERATOR_ID"() AND "GROUP_ID"=:B1))
27 - access("GROUP_ID"=:B1 AND "OPERATOR_ID"="LIMS$OPERATOR_ID"())
28 - access("GROUP_ID"=:B1 AND "OPERATOR_ID"="LIMS$OPERATOR_ID"())
29 - access("GROUP_ID"=:B1 AND "OPERATOR_ID"="LIMS$OPERATOR_ID"())
30 - access("GROUP_ID"=:B1 AND "OPERATOR_ID"="LIMS$OPERATOR_ID"())
31 - access("GROUP_ID"=:B1 AND "OPERATOR_ID"="LIMS$OPERATOR_ID"())
Note
- 'PLAN_TABLE' is old version
{code}
*tkprof 1*
{code}
TKPROF: Release 10.2.0.3.0 - Production on Tue Jan 13 13:21:47 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Trace file: C:\oracle\product\10.2.0\admin\nautp02\udump\nautp02_ora_880.trc
Sort options: default
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
SELECT sdu.u_crop_group,
sd.name as sdg_name,
ad.variety_name,
ad.batch_number,
a.name as aliquot_name,
sau.u_box_code as box_code,
sau.u_box_position as box_position,
t.name as test_name,
r.original_result,
plt.name as plate_name,
concat(chr(a.plate_row + 64),a.plate_column) as plate_position,
au.u_replicate_number as replicate_number
FROM lims_sys.sdg sd,
lims_sys.sdg_user sdu,
lims_sys.sample sa,
lims_sys.sample_user sau,
lims_sys.aliquot a,
lims_sys.aliquot_user au,
lims_sys.test t,
lims_sys.result r,
lims_sys.plate plt,
lims_sys.abs_determination ad
WHERE sd.sdg_id = sdu.sdg_id
AND sd.sdg_id = sa.sdg_id
AND sa.sample_id = sau.sample_id
AND sau.sample_id = a.sample_id
AND a.aliquot_id = au.aliquot_id
AND au.aliquot_id = t.aliquot_id
AND t.test_id = r.test_id
AND plt.plate_id (+) = a.plate_id
AND sdu.u_abs_determination = ad.determination_assignment
AND a.status IN ('V','P','C')
AND r.name = 'End result'
AND sdu.u_client_type = 'QC'
AND sdu.u_year_of_sample_delivery = (:year)
AND sdu.u_week_of_processing = (:week)
--AND decode(:cropcode,-1,'-1',sdu.u_crop_group) = decode(:cropcode,-1,'-1',:cropcode)
ORDER BY box_code, box_position, replicate_number
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 1.15 1.16 0 0 0 0
Fetch 1 8.53 16.10 227649 241266 0 500
total 3 9.68 17.27 227649 241266 0 500
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 97
Rows Row Source Operation
500 SORT ORDER BY (cr=241266 pr=227649 pw=0 time=16104631 us)
21311 FILTER (cr=241266 pr=227649 pw=0 time=16246749 us)
21311 HASH JOIN (cr=241266 pr=227649 pw=0 time=16225434 us)
17745 TABLE ACCESS FULL DWH_ABS_DETERMINATION (cr=374 pr=0 pw=0 time=69 us)
21311 HASH JOIN RIGHT OUTER (cr=240892 pr=227649 pw=0 time=16170607 us)
21895 VIEW PLATE (cr=316 pr=0 pw=0 time=43825 us)
21895 FILTER (cr=316 pr=0 pw=0 time=43823 us)
21895 TABLE ACCESS FULL PLATE (cr=316 pr=0 pw=0 time=31 us)
0 INDEX UNIQUE SCAN PK_OPERATOR_GROUP (cr=0 pr=0 pw=0 time=0 us)(object id 45769)
21311 HASH JOIN (cr=240576 pr=227649 pw=0 time=16106174 us)
21311 HASH JOIN (cr=133559 pr=121596 pw=0 time=9594130 us)
21311 HASH JOIN (cr=94323 pr=83281 pw=0 time=6917067 us)
21311 HASH JOIN (cr=86383 pr=75547 pw=0 time=5509672 us)
7776 HASH JOIN (cr=8134 pr=0 pw=0 time=285364 us)
7776 TABLE ACCESS BY INDEX ROWID SAMPLE (cr=572 pr=0 pw=0 time=27152 us)
7876 NESTED LOOPS (cr=377 pr=0 pw=0 time=488287 us)
99 HASH JOIN (cr=160 pr=0 pw=0 time=4168 us)
99 TABLE ACCESS FULL SDG_USER (cr=53 pr=0 pw=0 time=1209 us)
5719 TABLE ACCESS FULL SDG (cr=107 pr=0 pw=0 time=17 us)
7776 INDEX RANGE SCAN FK_SAMPLE_SDG (cr=217 pr=0 pw=0 time=623 us)(object id 45990)
1079741 TABLE ACCESS FULL SAMPLE_USER (cr=7562 pr=0 pw=0 time=24 us)
3307948 TABLE ACCESS FULL ALIQUOT (cr=78249 pr=75547 pw=0 time=3331129 us)
3406836 TABLE ACCESS FULL ALIQUOT_USER (cr=7940 pr=7734 pw=0 time=556 us)
3406832 TABLE ACCESS FULL TEST (cr=39236 pr=38315 pw=0 time=3413192 us)
3406832 TABLE ACCESS FULL RESULT (cr=107017 pr=106053 pw=0 time=6848487 us)
0 INDEX UNIQUE SCAN PK_OPERATOR_GROUP (cr=0 pr=0 pw=0 time=0 us)(object id 45769)
0 INDEX UNIQUE SCAN PK_OPERATOR_GROUP (cr=0 pr=0 pw=0 time=0 us)(object id 45769)
0 INDEX UNIQUE SCAN PK_OPERATOR_GROUP (cr=0 pr=0 pw=0 time=0 us)(object id 45769)
0 INDEX UNIQUE SCAN PK_OPERATOR_GROUP (cr=0 pr=0 pw=0 time=0 us)(object id 45769)
select 'x'
from
dual
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 0 0 1
total 3 0.00 0.00 0 0 0 1
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 97
Rows Row Source Operation
1 FAST DUAL (cr=0 pr=0 pw=0 time=3 us)
begin :id := sys.dbms_transaction.local_transaction_id; end;
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 1
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.00 0 0 0 1
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 97
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 3 0.00 0.00 0 0 0 0
Execute 3 1.15 1.16 0 0 0 1
Fetch 2 8.53 16.10 227649 241266 0 501
total 8 9.68 17.27 227649 241266 0 502
Misses in library cache during parse: 1
Misses in library cache during execute: 1
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 30 0.00 0.00 0 0 0 0
Execute 30 0.00 0.00 0 0 0 0
Fetch 30 0.00 0.00 0 40 0 10
total 90 0.00 0.00 0 40 0 10
Misses in library cache during parse: 0
3 user SQL statements in session.
30 internal SQL statements in session.
33 SQL statements in session.
Trace file: C:\oracle\product\10.2.0\admin\nautp02\udump\nautp02_ora_880.trc
Trace file compatibility: 10.01.00
Sort options: default
8 sessions in tracefile.
3 user SQL statements in trace file.
30 internal SQL statements in trace file.
33 SQL statements in trace file.
6 unique SQL statements in trace file.
633 lines in trace file.
23 elapsed seconds in trace file.
{code}explain 2
SQL Statement which produced this data:
select * from table(dbms_xplan.display)
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 71 | 24779 | 857 (1)|
| 1 | SORT ORDER BY | | 71 | 24779 | 857 (1)|
|* 2 | FILTER | | | | |
|* 3 | TABLE ACCESS BY INDEX ROWID | RESULT | 1 | 20 | 4 (0)|
| 4 | NESTED LOOPS | | 72 | 25128 | 856 (1)|
| 5 | NESTED LOOPS | | 70 | 23030 | 576 (1)|
|* 6 | HASH JOIN OUTER | | 69 | 20493 | 369 (1)|
| 7 | NESTED LOOPS | | 69 | 11247 | 285 (0)|
| 8 | NESTED LOOPS | | 69 | 10626 | 147 (0)|
| 9 | NESTED LOOPS | | 23 | 2438 | 78 (0)|
| 10 | NESTED LOOPS | | 23 | 2070 | 32 (0)|
| 11 | NESTED LOOPS | | 1 | 67 | 15 (0)|
| 12 | NESTED LOOPS | | 1 | 45 | 14 (0)|
|* 13 | TABLE ACCESS FULL | SDG_USER | 1 | 24 | 13 (0)|
| 14 | TABLE ACCESS BY INDEX ROWID| DWH_ABS_DETERMINATION | 1 | 21 | 1 (0)|
|* 15 | INDEX UNIQUE SCAN | PK_DWH_ABS_DETERMINATION | 1 | | 0 (0)|
| 16 | TABLE ACCESS BY INDEX ROWID | SDG | 1 | 22 | 1 (0)|
|* 17 | INDEX UNIQUE SCAN | PK_SDG | 1 | | 0 (0)|
| 18 | TABLE ACCESS BY INDEX ROWID | SAMPLE | 190 | 4370 | 17 (0)|
|* 19 | INDEX RANGE SCAN | FK_SAMPLE_SDG | 597 | | 2 (0)|
| 20 | TABLE ACCESS BY INDEX ROWID | SAMPLE_USER | 1 | 16 | 2 (0)|
|* 21 | INDEX UNIQUE SCAN | PK_SAMPLE_USER | 1 | | 1 (0)|
|* 22 | TABLE ACCESS BY INDEX ROWID | ALIQUOT | 3 | 144 | 3 (0)|
|* 23 | INDEX RANGE SCAN | FK_ALIQUOT_SAMPLE | 3 | | 2 (0)|
| 24 | TABLE ACCESS BY INDEX ROWID | ALIQUOT_USER | 1 | 9 | 2 (0)|
|* 25 | INDEX UNIQUE SCAN | PK_ALIQUOT_USER | 1 | | 1 (0)|
| 26 | VIEW | PLATE | 21787 | 2851K| 84 (2)|
|* 27 | FILTER | | | | |
| 28 | TABLE ACCESS FULL | PLATE | 21787 | 574K| 84 (2)|
|* 29 | INDEX UNIQUE SCAN | PK_OPERATOR_GROUP | 1 | 7 | 0 (0)|
| 30 | TABLE ACCESS BY INDEX ROWID | TEST | 1 | 32 | 3 (0)|
|* 31 | INDEX RANGE SCAN | FK_TEST_ALIQUOT | 1 | | 2 (0)|
|* 32 | INDEX RANGE SCAN | FK_RESULT_TEST | 2 | | 2 (0)|
|* 33 | INDEX UNIQUE SCAN | PK_OPERATOR_GROUP | 1 | 7 | 0 (0)|
|* 34 | INDEX UNIQUE SCAN | PK_OPERATOR_GROUP | 1 | 7 | 0 (0)|
|* 35 | INDEX UNIQUE SCAN | PK_OPERATOR_GROUP | 1 | 7 | 0 (0)|
|* 36 | INDEX UNIQUE SCAN | PK_OPERATOR_GROUP | 1 | 7 | 0 (0)|
Predicate Information (identified by operation id):
2 - filter(("GROUP_ID" IS NULL OR EXISTS (SELECT /*+ */ 0 FROM "LIMS"."OPERATOR_GROUP"
"OPERATOR_GROUP" WHERE "OPERATOR_ID"="LIMS$OPERATOR_ID"() AND "GROUP_ID"=:B1)) AND ("GROUP_ID"
IS NULL OR EXISTS (SELECT /*+ */ 0 FROM "LIMS"."OPERATOR_GROUP" "OPERATOR_GROUP" WHERE
"OPERATOR_ID"="LIMS$OPERATOR_ID"() AND "GROUP_ID"=:B2)) AND ("GROUP_ID" IS NULL OR EXISTS
(SELECT /*+ */ 0 FROM "LIMS"."OPERATOR_GROUP" "OPERATOR_GROUP" WHERE
"OPERATOR_ID"="LIMS$OPERATOR_ID"() AND "GROUP_ID"=:B3)) AND ("GROUP_ID" IS NULL OR EXISTS
(SELECT /*+ */ 0 FROM "LIMS"."OPERATOR_GROUP" "OPERATOR_GROUP" WHERE
"OPERATOR_ID"="LIMS$OPERATOR_ID"() AND "GROUP_ID"=:B4)))
3 - filter("NAME"='End result')
6 - access("PLT"."PLATE_ID"(+)="PLATE_ID")
13 - filter("U_ABS_DETERMINATION" IS NOT NULL AND "U_CLIENT_TYPE"='QC' AND
"U_WEEK_OF_PROCESSING"=TO_NUMBER(:WEEK) AND "U_YEAR_OF_SAMPLE_DELIVERY"=TO_NUMBER(:YEAR) AND
DECODE(:CROPCODE,(-1),'-1',"U_CROP_GROUP")=DECODE(:CROPCODE,(-1),'-1',:CROPCODE))
15 - access("U_ABS_DETERMINATION"="DETERMINATION_ASSIGNMENT")
17 - access("SDG_ID"="SDG_ID")
19 - access("SDG_ID"="SDG_ID")
21 - access("SAMPLE_ID"="SAMPLE_ID")
22 - filter("STATUS"='C' OR "STATUS"='P' OR "STATUS"='V')
23 - access("SAMPLE_ID"="SAMPLE_ID")
25 - access("ALIQUOT_ID"="ALIQUOT_ID")
27 - filter("GROUP_ID" IS NULL OR EXISTS (SELECT /*+ */ 0 FROM "LIMS"."OPERATOR_GROUP"
"OPERATOR_GROUP" WHERE "OPERATOR_ID"="LIMS$OPERATOR_ID"() AND "GROUP_ID"=:B1))
29 - access("GROUP_ID"=:B1 AND "OPERATOR_ID"="LIMS$OPERATOR_ID"())
31 - access("ALIQUOT_ID"="ALIQUOT_ID")
32 - access("TEST_ID"="TEST_ID")
33 - access("GROUP_ID"=:B1 AND "OPERATOR_ID"="LIMS$OPERATOR_ID"())
34 - access("GROUP_ID"=:B1 AND "OPERATOR_ID"="LIMS$OPERATOR_ID"())
35 - access("GROUP_ID"=:B1 AND "OPERATOR_ID"="LIMS$OPERATOR_ID"())
36 - access("GROUP_ID"=:B1 AND "OPERATOR_ID"="LIMS$OPERATOR_ID"())
Note
- 'PLAN_TABLE' is old version
tkprof 2
TKPROF: Release 10.2.0.3.0 - Production on Tue Jan 13 13:28:26 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Trace file: C:\oracle\product\10.2.0\admin\nautp02\udump\nautp02_ora_5456.trc
Sort options: default
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
SELECT sdu.u_crop_group,
sd.name as sdg_name,
ad.variety_name,
ad.batch_number,
a.name as aliquot_name,
sau.u_box_code as box_code,
sau.u_box_position as box_position,
t.name as test_name,
r.original_result,
plt.name as plate_name,
concat(chr(a.plate_row + 64),a.plate_column) as plate_position,
au.u_replicate_number as replicate_number
FROM lims_sys.sdg sd,
lims_sys.sdg_user sdu,
lims_sys.sample sa,
lims_sys.sample_user sau,
lims_sys.aliquot a,
lims_sys.aliquot_user au,
lims_sys.test t,
lims_sys.result r,
lims_sys.plate plt,
lims_sys.abs_determination ad
WHERE sd.sdg_id = sdu.sdg_id
AND sd.sdg_id = sa.sdg_id
AND sa.sample_id = sau.sample_id
AND sau.sample_id = a.sample_id
AND a.aliquot_id = au.aliquot_id
AND au.aliquot_id = t.aliquot_id
AND t.test_id = r.test_id
AND plt.plate_id (+) = a.plate_id
AND sdu.u_abs_determination = ad.determination_assignment
AND a.status IN ('V','P','C')
AND r.name = 'End result'
AND sdu.u_client_type = 'QC'
AND sdu.u_year_of_sample_delivery = (:year)
AND sdu.u_week_of_processing = (:week)
AND decode(:cropcode,-1,'-1',sdu.u_crop_group) = decode(:cropcode,-1,'-1',:cropcode)
ORDER BY box_code, box_position, replicate_number
call count cpu elapsed disk query current rows
Parse 1 0.01 0.00 0 0 0 0
Execute 1 0.45 0.87 0 0 0 0
Fetch 1 1.00 0.99 0 221420 0 500
total 3 1.46 1.86 0 221420 0 500
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 97
Rows Row Source Operation
500 SORT ORDER BY (cr=221420 pr=0 pw=0 time=992364 us)
21311 FILTER (cr=221420 pr=0 pw=0 time=1128970 us)
21311 TABLE ACCESS BY INDEX ROWID RESULT (cr=221420 pr=0 pw=0 time=1086345 us)
42623 NESTED LOOPS (cr=217549 pr=0 pw=0 time=30006317 us)
21311 NESTED LOOPS (cr=174880 pr=0 pw=0 time=809278 us)
21311 NESTED LOOPS (cr=110117 pr=0 pw=0 time=553538 us)
21311 HASH JOIN OUTER (cr=46182 pr=0 pw=0 time=319102 us)
21311 TABLE ACCESS BY INDEX ROWID ALIQUOT (cr=45866 pr=0 pw=0 time=193037 us)
29088 NESTED LOOPS (cr=39885 pr=0 pw=0 time=320084 us)
7776 NESTED LOOPS (cr=24267 pr=0 pw=0 time=156721 us)
7776 NESTED LOOPS (cr=937 pr=0 pw=0 time=78954 us)
99 NESTED LOOPS (cr=454 pr=0 pw=0 time=3826 us)
99 NESTED LOOPS (cr=253 pr=0 pw=0 time=2833 us)
99 TABLE ACCESS FULL SDG_USER (cr=53 pr=0 pw=0 time=1531 us)
99 TABLE ACCESS BY INDEX ROWID DWH_ABS_DETERMINATION (cr=200 pr=0 pw=0 time=956 us)
99 INDEX UNIQUE SCAN PK_DWH_ABS_DETERMINATION (cr=101 pr=0 pw=0 time=438 us)(object id 46965)
99 TABLE ACCESS BY INDEX ROWID SDG (cr=201 pr=0 pw=0 time=707 us)
99 INDEX UNIQUE SCAN PK_SDG (cr=101 pr=0 pw=0 time=330 us)(object id 46071)
7776 TABLE ACCESS BY INDEX ROWID SAMPLE (cr=483 pr=0 pw=0 time=16261 us)
7776 INDEX RANGE SCAN FK_SAMPLE_SDG (cr=217 pr=0 pw=0 time=562 us)(object id 45990)
7776 TABLE ACCESS BY INDEX ROWID SAMPLE_USER (cr=23330 pr=0 pw=0 time=64710 us)
7776 INDEX UNIQUE SCAN PK_SAMPLE_USER (cr=15554 pr=0 pw=0 time=33728 us)(object id 46012)
21311 INDEX RANGE SCAN FK_ALIQUOT_SAMPLE (cr=15618 pr=0 pw=0 time=43423 us)(object id 45346)
21895 VIEW PLATE (cr=316 pr=0 pw=0 time=43833 us)
21895 FILTER (cr=316 pr=0 pw=0 time=21936 us)
21895 TABLE ACCESS FULL PLATE (cr=316 pr=0 pw=0 time=37 us)
0 INDEX UNIQUE SCAN PK_OPERATOR_GROUP (cr=0 pr=0 pw=0 time=0 us)(object id 45769)
21311 TABLE ACCESS BY INDEX ROWID ALIQUOT_USER (cr=63935 pr=0 pw=0 time=182479 us)
21311 INDEX UNIQUE SCAN PK_ALIQUOT_USER (cr=42624 pr=0 pw=0 time=99160 us)(object id 45386)
21311 TABLE ACCESS BY INDEX ROWID TEST (cr=64763 pr=0 pw=0 time=219096 us)
21311 INDEX RANGE SCAN FK_TEST_ALIQUOT (cr=42669 pr=0 pw=0 time=129354 us)(object id 46222)
21311 INDEX RANGE SCAN FK_RESULT_TEST (cr=42669 pr=0 pw=0 time=125893 us)(object id 45940)
0 INDEX UNIQUE SCAN PK_OPERATOR_GROUP (cr=0 pr=0 pw=0 time=0 us)(object id 45769)
0 INDEX UNIQUE SCAN PK_OPERATOR_GROUP (cr=0 pr=0 pw=0 time=0 us)(object id 45769)
0 INDEX UNIQUE SCAN PK_OPERATOR_GROUP (cr=0 pr=0 pw=0 time=0 us)(object id 45769)
0 INDEX UNIQUE SCAN PK_OPERATOR_GROUP (cr=0 pr=0 pw=0 time=0 us)(object id 45769)
select 'x'
from
dual
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 0 0 1
total 3 0.00 0.00 0 0 0 1
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 97
Rows Row Source Operation
1 FAST DUAL (cr=0 pr=0 pw=0 time=6 us)
begin :id := sys.dbms_transaction.local_transaction_id; end;
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 2 0
Execute 1 0.00 0.00 0 0 0 1
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.00 0 0 2 1
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 97
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 3 0.01 0.00 0 0 2 0
Execute 3 0.45 0.87 0 0 0 1
Fetch 2 1.00 0.99 0 221420 0 501
total 8 1.46 1.87 0 221420 2 502
Misses in library cache during parse: 2
Misses in library cache during execute: 2
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 43 0.01 0.00 0 0 12 0
Execute 128 0.00 0.01 0 0 0 0
Fetch 178 0.00 0.00 0 383 0 465
total 349 0.01 0.02 0 383 12 465
Misses in library cache during parse: 5
Misses in library cache during execute: 5
3 user SQL statements in session.
128 internal SQL statements in session.
131 SQL statements in session.
Trace file: C:\oracle\product\10.2.0\admin\nautp02\udump\nautp02_ora_5456.trc
Trace file compatibility: 10.01.00
Sort options: default
1 session in tracefile.
3 user SQL statements in trace file.
128 internal SQL statements in trace file.
131 SQL statements in trace file.
19 unique SQL statements in trace file.
1352 lines in trace file.
287 elapsed seconds in trace file. -
Explain plan shows 300T of TempSpc and 999 hours - tuning request
Hi,
I have a query which obtains summary statistics. There is an items table which contains the dictionary of items which can be recorded. There is an events table which contains the item ID, timestamp and a value. The query summarizes the data for each item. e.g. Mean, stddev, sample values, length. I have trimmed the query down as simply as possible and am having a problem with large temp space and runtime estimates in the explain plan. Here is the query:
WITH ChartItems AS (
SELECT
ci.itemid,
ci.label,
ci.category,
ci.description,
COUNT(*),
COUNT(distinct subject_id)
FROM mimic2v26.d_chartitems ci
JOIN mimic2v26.chartevents ce ON ce.itemid = ci.itemid
--WHERE ci.itemid = 51
GROUP BY ci.itemid,
ci.label,
ci.category,
ci.description
--select * from ChartItems;
, RawData AS (
SELECT DISTINCT
ci.itemid,
ci.label,
ci.category,
ci.description,
last_value(ce.value1) ignore nulls over (partition BY ci.itemid order by
ce.charttime ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS
value1_last
FROM ChartItems ci
JOIN mimic2v26.chartevents ce ON ce.itemid = ci.itemid
select * from RawData;Which gives this explain plan:
Plan hash value: 642453121
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 4811G| 1238T| | 3686M (13)|999:59:59 |
| 1 | VIEW | | 4811G| 1238T| | 3686M (13)|999:59:59 |
| 2 | HASH UNIQUE | | 4811G| 258T| | 3686M (13)|999:59:59 |
| 3 | WINDOW BUFFER | | 4811G| 258T| | 3686M (13)|999:59:59 |
| 4 | SORT GROUP BY | | 4811G| 258T| 317T| 3686M (13)|999:59:59 |
|* 5 | HASH JOIN | | 4811G| 258T| 4943M| 25M (90)| 85:14:28 |
| 6 | VIEW | VW_DAG_0 | 152M| 3199M| | 1366K (1)| 04:33:18 |
| 7 | HASH GROUP BY | | 152M| 4216M| 5839M| 1366K (1)| 04:33:18 |
|* 8 | HASH JOIN | | 152M| 4216M| | 147K (2)| 00:29:36 |
| 9 | TABLE ACCESS FULL | D_CHARTITEMS | 4832 | 96640 | | 7 (0)| 00:00:01 |
| 10 | INDEX FAST FULL SCAN| CHARTEVENTS_O2 | 196M| 1683M| | 147K (1)| 00:29:25 |
| 11 | TABLE ACCESS FULL | CHARTEVENTS | 196M| 6922M| | 616K (1)| 02:03:19 |
Predicate Information (identified by operation id):
5 - access("CE"."ITEMID"="ITEM_2")300T of temp space! Ouch.
TKPROF output (I let the query run for a short while. I let it run for ages earlier, but wasn't tracing the session. Should I let it run for longer?):
TKPROF: Release 11.2.0.3.0 - Development on Tue Jul 10 16:54:27 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Trace file: /oracle/11gr2/app/oracle/diag/rdbms/mimic2/mimic2/trace/mimic2_ora_6507.trc
Sort options: default
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
WITH ChartItems AS (
SELECT
ci.itemid,
ci.label,
ci.category,
ci.description,
COUNT(*),
COUNT(distinct subject_id)
FROM mimic2v26.d_chartitems ci
JOIN mimic2v26.chartevents ce ON ce.itemid = ci.itemid
GROUP BY ci.itemid,
ci.label,
ci.category,
ci.description
, RawData AS (
SELECT DISTINCT
ci.itemid,
ci.label,
ci.category,
ci.description,
last_value(ce.value1) ignore nulls over (partition BY ci.itemid order by
ce.charttime ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS
value1_last
FROM ChartItems ci
JOIN mimic2v26.chartevents ce ON ce.itemid = ci.itemid
select * from RawData
call count cpu elapsed disk query current rows
Parse 1 0.02 0.02 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 582.40 712.23 705238 737351 0 0
total 3 582.43 712.25 705238 737351 0 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 85
Number of plan statistics captured: 1
Rows (1st) Rows (avg) Rows (max) Row Source Operation
0 0 0 VIEW (cr=0 pr=0 pw=0 time=184 us cost=3686387254 size=1361581801333882 card=4811243114254)
0 0 0 HASH UNIQUE (cr=0 pr=0 pw=0 time=180 us cost=3686387254 size=283863343740986 card=4811243114254)
0 0 0 WINDOW BUFFER (cr=0 pr=0 pw=0 time=74 us cost=3686387254 size=283863343740986 card=4811243114254)
0 0 0 SORT GROUP BY (cr=0 pr=0 pw=0 time=59 us cost=3686387254 size=283863343740986 card=4811243114254)
178073889 178073889 178073889 HASH JOIN (cr=737351 pr=705238 pw=124635 time=476372451 us cost=25572251 size=283863343740986 card=4811243114254)
6211631 6211631 6211631 VIEW VW_DAG_0 (cr=613768 pr=581413 pw=35805 time=286546567 us cost=1366486 size=3354399576 card=152472708)
6211631 6211631 6211631 HASH GROUP BY (cr=613768 pr=581413 pw=35805 time=281271878 us cost=1366486 size=4421708532 card=152472708)
196182740 196182740 196182740 HASH JOIN (cr=613768 pr=545608 pw=0 time=557485047 us cost=147987 size=4421708532 card=152472708)
4832 4832 4832 TABLE ACCESS FULL D_CHARTITEMS (cr=18 pr=16 pw=0 time=13666 us cost=7 size=96640 card=4832)
196182740 196182740 196182740 INDEX FAST FULL SCAN CHARTEVENTS_O2 (cr=613750 pr=545592 pw=0 time=148428499 us cost=147046 size=1765644660 card=196182740)(object id 96501)
10683044 10683044 10683044 TABLE ACCESS FULL CHARTEVENTS (cr=123583 pr=123825 pw=0 time=25175510 us cost=616507 size=7258761380 card=196182740)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
db file sequential read 2 0.01 0.01
db file scattered read 3 0.02 0.03
direct path read 5265 0.75 77.13
asynch descriptor resize 1 0.00 0.00
direct path write temp 15077 0.71 45.54
direct path read temp 2387 0.29 13.54
SQL*Net break/reset to client 1 0.66 0.66
SQL*Net message from client 1 0.00 0.00
SQL ID: 7jby2dxrpkkm9 Plan Hash: 1388734953
select SYS_CONTEXT('USERENV','SESSIONID')
from
dual
call count cpu elapsed disk query current rows
Parse 1 0.00 0.01 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 0 0 1
total 3 0.00 0.01 0 0 0 1
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 85
Number of plan statistics captured: 1
Rows (1st) Rows (avg) Rows (max) Row Source Operation
1 1 1 FAST DUAL (cr=0 pr=0 pw=0 time=4 us cost=2 size=0 card=1)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 2 0.02 0.04 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 2 582.40 712.23 705238 737351 0 1
total 6 582.43 712.27 705238 737351 0 1
Misses in library cache during parse: 2
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 4 0.00 0.00
db file sequential read 2 0.01 0.01
db file scattered read 3 0.02 0.03
direct path read 5265 0.75 77.13
asynch descriptor resize 1 0.00 0.00
direct path write temp 15077 0.71 45.54
direct path read temp 2387 0.29 13.54
SQL*Net break/reset to client 1 0.66 0.66
SQL*Net message from client 3 14.99 15.01
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 0 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 0 0.00 0.00 0 0 0 0
Misses in library cache during parse: 0
2 user SQL statements in session.
0 internal SQL statements in session.
2 SQL statements in session.
Trace file: /oracle/11gr2/app/oracle/diag/rdbms/mimic2/mimic2/trace/mimic2_ora_6507.trc
Trace file compatibility: 11.1.0.7
Sort options: default
1 session in tracefile.
2 user SQL statements in trace file.
0 internal SQL statements in trace file.
2 SQL statements in trace file.
2 unique SQL statements in trace file.
24245 lines in trace file.
728 elapsed seconds in trace file.Optimizer parameters:
NAME TYPE VALUE
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 Can anyone help me figure out what's wrong?
This is a data warehouse, with up to date statistics. The DB is version 11.2.0.3.0
Thanks,
Danrp0428 wrote:
>
I trimmed the query down to the simplest that I could which still exhibited the problem
>
The DISTINCT isn't the issue. The issue is that the query you posted isn't necessary and doesn't appear to be represented in the plan that you posted.
That makes it hard to tell where the cardinality misestimates are coming from. How many records does the actual first query (the one with the group by) return? You have a SELECT * commented out - how many rows?No, it's not necessary, but then it isn't the full query. The estimates are still wrong when I pass the count columns through to the second query. The full query contains many more analytic functions in the second query, and some additions to the first. It could probably be cleaned up a little, but the current structure makes logical sense. Should I change the aggregates to analytics and move them into the second query? In any case, there definitely seems to be something wrong with the plan.
I don't know what you mean when you say "doesn't appear to be represented in the plan that you posted".
I just checked the first query and while the temp space has dropped to a reasonable amount, the number of rows in the hash join is still way off (I didn't notice before because I was looking at the temp space). The rows for d_chartitems and the index on chartevents are correct:
Plan hash value: 1249235674
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 152M| 35G| | 1366K (1)| 04:33:18 |
| 1 | VIEW | | 152M| 35G| | 1366K (1)| 04:33:18 |
| 2 | WINDOW SORT | | 152M| 4216M| 5839M| 1366K (1)| 04:33:18 |
|* 3 | HASH JOIN | | 152M| 4216M| | 147K (2)| 00:29:36 |
| 4 | TABLE ACCESS FULL | D_CHARTITEMS | 4832 | 96640 | | 7 (0)| 00:00:01 |
| 5 | INDEX FAST FULL SCAN| CHARTEVENTS_O2 | 196M| 1683M| | 147K (1)| 00:29:25 |
Predicate Information (identified by operation id):
3 - access("CE"."ITEMID"="CI"."ITEMID")Edited by: danscott on Jul 10, 2012 5:43 PM
Edited by: danscott on Jul 11, 2012 6:28 AM
Maybe you are looking for
-
How to get free AVG Net Security Update for Mac
I have AVG Internet Security anti-virus on one of my Macs and got a notice there is an update. However, everything I find on the AVG site and elsewhere is .exe files and not for Mac. WHERE do I get the correct one? And a notice appears saying it is n
-
Hi, Using ActionScript 2.0 Flash CS3. I want to navigate to a foreign language URL which comes from an XML. XML is in UTF -8 format. After loading the XML, i used trace() statement to check the URL is correct. No problem in that. Successfully navigat
-
HT2736 how much time does it need to arrive to the email?
i sent my brother an album as a gift on iTunes. is it possible to make it arrive now? i put today's date as the arrival date. so, is there a certain hour that the gift arrives to the email? thanks, Tom
-
Hi guys, I've been using this as a drop down menu Animated Responsive Drop Down Menu | CSS MenuMaker However Ido not know how to make the links with aniframe, I've googled everything and when it comes to coding I am really bad... Can anyone give me a
-
Search function in Mail seems off
I just bought a new MacBook Pro, and I've transfered my Mail mailboxes from my old 10.3.9 computer to 10.5.2 on the new computer. Everything seems fine, with one exception. When I search in Mail, using the criteria "Entire Message", mail always retur