%CPU Value on plan_table_output

Does anyone know how the %CPU value is calculated when using dbms_xplan.display in oracle 10g?
I'm sure it comes from plan_table (v$sql_plan) but I can't figure out how the value is calculated...
Thanks

user8873443 wrote:
Does anyone know how the %CPU value is calculated when using dbms_xplan.display in oracle 10g?
I'm sure it comes from plan_table (v$sql_plan) but I can't figure out how the value is calculated...
ThanksFrom the documentation:
http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/ex_plan.htm
"COST: Cost of the operation as estimated by the optimizer's query approach. Cost is not determined for table access operations. The value of this column does not have any particular unit of measurement; it is merely a weighted value used to compare costs of execution plans. The value of this column is a function of the CPU_COST and IO_COST columns.
CPU_COST: CPU cost of the operation as estimated by the query optimizer's approach. The value of this column is proportional to the number of machine cycles required for the operation. For statements that use the rule-based approach, this column is null.
IO_COST: I/O cost of the operation as estimated by the query optimizer's approach. The value of this column is proportional to the number of data blocks read by the operation. For statements that use the rule-based approach, this column is null."
You could try to perform a test like the following:
1. Create a dummy table named T1, in my case I am using a test table with 100,000 rows.
2. Experiment:
EXPLAIN PLAN FOR SELECT COUNT(*) FROM T1;
Explained.
SELECT
  ID,
  CPU_COST,
  IO_COST,
  COST
FROM
  PLAN_TABLE;
ID   CPU_COST    IO_COST       COST
0   13331709         11         13
1
2   13331709         11         13
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
Plan hash value: 2552807428
| Id  | Operation             | Name         | Rows  | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT      |              |     1 |    13  (16)| 00:00:01 |
|   1 |  SORT AGGREGATE       |              |     1 |            |          |
|   2 |   INDEX FAST FULL SCAN| SYS_C0020571 |   100K|    13  (16)| 00:00:01 |
------------------------------------------------------------------------------From the above, the total cost of ID 0 is 13, of which 11 is the IO cost. Therefore, the CPU cost is 13-11 = 2. 2/13 = 15.38%. 15.38% rounded up is 16%. That might be the meaning of the %CPU column in the DBMS_XPLAN output.
Charles Hooper
Co-author of "Expert Oracle Practices: Oracle Database Administration from the Oak Table"
http://hoopercharles.wordpress.com/
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc.

Similar Messages

  • Process Snmp (PDU Dispatcher) causes High CPU value

    Hello,
    I have a Catalyst Switch 6000. Inoticed that after the execution of the job inventory in LMS, and after the snmp queries reached the equipement, the cpu value reached 98-99 % due to the process : PDU DISPATCHER (what’s it ?)
    I have also a script running in the switch to observe the differents logs. For exemple, when high cpu is obtained, the message bellow appear :
    « %SNMP-3-INPUT_QFULL_ERR: Packet dropped due to input
    « %SNMP-3-INPUT_QFULL_ERR: Packet dropped due to input
    « %SNMP-3-INPUT_QFULL_ERR: Packet dropped due to input
    Could you give me any idea or help ?
    Thanks in advance.

    This msg is normally generated when to many snmp request overrun the buffer allocated for such requests. There are a number of things that can cause this as well as a number of known issues that can be worked around using snmp views. Without reviewing show logging and other information available in a show tech, hard to say what the best method to resolve this. Should probably open a TAC SR to troubleshoot the issue further...
    Sent from Cisco Technical Support iPad App

  • Powershell command to get cpu percentage as displayed in task manager

    Hi,
    I wish to extract the memory and cpu data of each process as shown in task manager. I am able to get the memory size in mb, but
    PercentProcessorTime does not return the exact process's cpu % value shown in task manager.
    function GetProcessInfoByName ([string]$processName)
    Get-WmiObject -class Win32_PerfFormattedData_PerfProc_Process | where{$_.name -eq $processName} | Select-Object
    @{Name="Process Name"; Expression = {$_.name}},
    @{Name="CPU (%)"; Expression = {$_.PercentProcessorTime}},
    @{Name="Memory (MB)"; Expression = {[Math]::Round(($_.workingSetPrivate / 1mb),2)}}
    Get-Process | ForEach-Object {$proc = $_; GetProcessInfoByName $proc.Name} | Format-Table -AutoSize
    Please help! Thanks.

    You'll find that determining the exact CPU usage is very difficult because of the always changing value and also because you want an average, not a peak at a particular point in time.
    As an example, on my task manager my powershell_ise was never consuming 12% CPU (not even 1%), that was a peak that got caught by the script (as seen in my screenshot above).
    I found I get more consistent results (not perfect though) with this variation of the script, which uses Get-Counter to query information:
    $CpuCores = (Get-WMIObject Win32_ComputerSystem).NumberOfLogicalProcessors
    (Get-Counter "\Process(*)\% Processor Time").CounterSamples | Select InstanceName, @{Name="CPU %";Expression={[Decimal]::Round(($_.CookedValue / $CpuCores), 2)}}
    The only problem here is that this does not give you the memory, which is something you're also after.
    And while you could join it to the results of the memory retrieved in another way, it doesn't return a PID, just a process name so if you have same many instances of the same program open... you'll get into trouble trying to match them.
    You could of course just join them all as one and say... I have 20 powershell.exe processes open and as a whole they're using 10% CPU and 200Mb ram, but that might not be what you're after...

  • Query performance difference -- CPU time difference on two servers

    Two SQL servers, server A & B, Hardware information as below:
    Server A: Clustered. Two physical processors (4 cores). RAM 64GB, SQL Server max memory: 58GB.
    Server B: Standalone. One physical processor (4 cores). RAM 16GB, SQL Server max memory: 10GB.
    The two databases on A & B are identical (using backup & restore method), same query execution CPU time are different, it is slower on the cluster server with more CPU & Mmeory. I tried many times and all same result, I also tried run DBCC DROPCLEANBUFFERS
    & DBCC FREEPROCCACHE before running the query.
    When I run the query, on Server A (Slow one), CPU usage is at 20% ~30%. RAM usage is 14%. It is new set up environment so just me using it now.
    When I run the query on Server B (Fast one), CPU usage is 40%, RAM usage is 85%.
    Both two servers have SAN connected storage.
    Query execution plan is exactly same on two serers.
    Could someone give me some advise how to troubleshoot this problem? Any suggestion is appreciated a lot! Thanks a lot!
    FYI, Below are the statistics when running same query in same DB on two servers:
    Server A CPU & IO Statistics:
    SQL Server parse and compile time: 
       CPU time = 109 ms, elapsed time = 297 ms.
    (1005301 row(s) affected)
    Table 'PODT'. Scan count 1, logical reads 55184, physical reads 3, read-ahead reads 55180, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'MRICLDEFENT'. Scan count 0, logical reads 71898, physical reads 3, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'POHD'. Scan count 1, logical reads 103154, physical reads 3, read-ahead reads 103150, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
     SQL Server Execution Times:
    CPU time = 7769 ms,  elapsed time = 16693 ms.
    Server B CPU & IO Statistics:
    SQL Server parse and compile time: 
       CPU time = 32 ms, elapsed time = 39 ms.
    (1005301 row(s) affected)
    Table 'PODT'. Scan count 1, logical reads 55184, physical reads 3, read-ahead reads 55180, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'MRICLDEFENT'. Scan count 0, logical reads 71898, physical reads 3, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'POHD'. Scan count 1, logical reads 103154, physical reads 3, read-ahead reads 103150, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
     SQL Server Execution Times:
    CPU time = 3931 ms,  elapsed time = 14387 ms.                             

    hi, Vivian_Vivian
    i just want to ask you 
    which sql version do you use?
    have you ever tried xevent before??
    if you use the sql2k8 or latter you can try xevent out to find somgthing clues about your cpu time problem
    i provide you the script,pls post your output in the xevent here so that we could judge what  the head of the problem is
    USE [master]
    GO
    CREATE EVENT SESSION [TrackSQLWait] ON SERVER
    ADD EVENT sqlserver.sql_statement_starting (
        ACTION ( sqlserver.session_id, sqlserver.database_id,sqlserver.sql_text ,package0.collect_system_time)
        WHERE ( sqlserver.database_id = 7 ) ), --★Do
    ADD EVENT sqlserver.sql_statement_completed (
        ACTION ( sqlserver.session_id, sqlserver.database_id, sqlserver.sql_text ,package0.collect_system_time)
        WHERE ( sqlserver.database_id = 7 ) ), --★Do
    ADD EVENT sqlserver.error_reported (
        ACTION ( sqlserver.session_id, sqlserver.database_id, sqlserver.sql_text ,package0.collect_system_time)
        WHERE ( sqlserver.database_id = 7 ) ), --★Do
    ADD EVENT sqlos.wait_info (
        ACTION ( sqlserver.database_id, sqlserver.session_id, sqlserver.sql_text,sqlserver.plan_handle ,package0.collect_system_time)
        WHERE 
        ( duration > 1000
          AND ( ( wait_type > 31    -- Waits for latches and important wait resources (not locks) 
                                -- that have exceeded 10 seconds. 
                  AND ( ( wait_type > 47
                          AND wait_type < 54
                        OR wait_type < 38
                        OR ( wait_type > 63
                             AND wait_type < 70
                        OR ( wait_type > 96
                             AND wait_type < 100
                        OR ( wait_type = 107 )
                        OR ( wait_type = 113 )
                        OR ( wait_type > 174
                             AND wait_type < 179
                        OR ( wait_type = 186 )
                        OR ( wait_type = 207 )
                        OR ( wait_type = 269 )
                        OR ( wait_type = 283 )
                        OR ( wait_type = 284 )
                OR ( duration > 30000        -- Waits for locks that have exceeded 30 secs.
                     AND wait_type < 22
    ADD TARGET package0.asynchronous_file_target (  SET filename = 'E:\ExtendedEvent\TrackSQLWait.xel' ,
                                                    metadatafile = 'E:\ExtendedEvent\TrackSQLWait.xem' )
    WITH ( MAX_MEMORY = 4 MB ,
            EVENT_RETENTION_MODE = ALLOW_SINGLE_EVENT_LOSS )
    GO
    ALTER EVENT SESSION [TrackSQLWait]
    ON SERVER
    STATE=START
    -- Query the Event data from the Target.
    SELECT  event_data.value('(event/@name)[1]', 'varchar(50)') AS [event_name] ,
            event_data.value('(event/data[@name="source_database_id"]/value)[1]',
                             'int') AS [source_database_id] ,
            OBJECT_NAME(event_data.value('(event/data[@name="object_id"]/value)[1]',
                                         'int')) AS [object] ,
            event_data.value('(event/data[@name="object_type"]/value)[1]',
                             'varchar(60)') AS [object_type] ,
            event_data.value('(event/data[@name="state"]/text)[1]', 'varchar(50)') AS [state] ,
            event_data.value('(event/data[@name="duration"]/value)[1]', 'bigint') AS [duration] ,
            event_data.value('(event/data[@name="cpu"]/value)[1]', 'bigint') AS [cpu] ,
            event_data.value('(event/data[@name="reads"]/value)[1]', 'bigint') AS [reads] ,
            event_data.value('(event/data[@name="writes"]/value)[1]', 'bigint') AS [writes] ,
            event_data.value('(event/data[@name="error"]/value)[1]', 'bigint') AS [error] ,
            event_data.value('(event/data[@name="severity"]/value)[1]', 'int') AS [severity] ,
            event_data.value('(event/data[@name="user_defined"]/value)[1]',
                             'varchar(5)') AS [user_defined] ,
            event_data.value('(event/data[@name="message"]/value)[1]',
                             'varchar(max)') AS [message] ,
            event_data.value('(event/data[@name="wait_type"]/text)[1]',
                             'varchar(250)') AS wait_typetype ,
            event_data.value('(event/data[@name="wait_type"]/value)[1]',
                             'varchar(250)') AS wait_typevalue ,
            event_data.value('(event/data[@name="max_duration"]/value)[1]',
                             'bigint') AS max_duration ,
            event_data.value('(event/data[@name="completed_count"]/value)[1]',
                             'bigint') AS [completed_count] ,
            event_data.value('(event/action[@name="plan_handle"]/value)[1]',
                             'varchar(max)') AS [plan_handle] ,
            DATEADD(hh, DATEDIFF(hh, GETUTCDATE(), CURRENT_TIMESTAMP),
                    event_data.value('(event/action[@name="collect_system_time"]/text)[1]',
                                     'datetime2')) AS [system_time] ,
            event_data.value('(event/action[@name="session_id"]/value)[1]',
                             'bigint') AS [session_id] ,
            event_data.value('(event/action[@name="sql_text"]/value)[1]',
                             'varchar(max)') AS [sql_text]
    FROM    ( SELECT    CAST(event_data AS XML) AS event_data
              FROM      sys.fn_xe_file_target_read_file('E:\ExtendedEvent\TrackSQLWait_*.xel',
                                                        'E:\ExtendedEvent\TrackSQLWait_*.xem',
                                                        NULL, NULL)
            ) AS tab
    WHERE   event_data.value('(event/data[@name="duration"]/value)[1]', 'bigint') > 100
            AND event_data.value('(event/@name)[1]', 'varchar(50)') LIKE 'wait_info'
    ORDER BY [system_time]
    ALTER EVENT SESSION [TrackSQLWait]
    ON SERVER
    STATE=STOP
    GO
    DROP EVENT SESSION [TrackSQLWait] ON SERVER
    please replacing the related parameter to fit for your situation
    thanks

  • Strange cpu clock report DV7T 4100 CTO

    just bought the DV7T 4100 CTO with a core i7-720qm processor (windows 7 64bit)... updated the bios to F.23. The strangest thing is that every single diagnostic software (CPU-z, Hardware Monitor, Intels T-monitor...etc...etc) reports my CPU as a 930Mhz on idle...although im sure its supposed to be 1600Mhz...
    when i pump up prime 95... it reports 1750 Mhz ...            why is my CPU beeing reported as half the speed than it should be? (having intels turbo thingy in consideration here...)

    Ok...here's the main problem...
    the multiplier stays at x7 at idle (133 bus x 7 = 931Mhz)
    when in turbo mode it goes up to x13 (checked it with TrotthleStop...x13 is the maximum supported multiplier)  which brings the CPU to 1729Mhz...
    Problem 2. the temperature coresponds to the factory CPU values...since at 931 Mhz it stays at 50-55 C (sometimes 60)
    while at 1729Mhz it climbs up to 80 C... which is what most people would get if they had their real clocks...
    it almost seems as if the Bus speed or the multiplier value is reported divided by 2...            anyone know the benchmark CPU values of this (or a similar) model...so i can compare?                            
    Thanks in advance...

  • Question about CPU temperature

    Hi, I have just built a new system with the following,
    Motherboard - MSI 760GM-P23 (FX)
    CPU FX 6300
    and as this is my first venture over to the AMD side of PC's I have some questions about the CPU temp.
    The image below is from my system under load, I'm told that the temp readings from AMD CPU's are not accurate below 40c? 
    The FX 6300 'package temp' cant be accurate with a low of 13c it's simply not possible in a room that's almost 20c.
    What is TMPIN1? I hope that's not my actual CPU temp as 69c is way to high. and a Google search for TMPIN1 brings up lots of forum posts regarding MSI boards, Hence my post here.
    TMPIN0 looks like the most likely sensor for CPU temp but I'm just not sure, so which one is it? and where is TMPIN1 reading it's info from?
    Regards and many thanks, Dave 

    What you see with HWINFO is the readings from two different sources. One is the reported temp by the AMD sensor, the other is the same temp but as reported and translated by the Fintek chip that MSI generally uses on their boards.
    The differences in readings boils down to the digital signal to analog conversion by the two data suppliers, .i.e AMD sensor/Fintek chip.
    If in doubt, always use the higher reported temp as the acceptable one. Quite frankly, I would think what the Fintek reports is probably close to what the real temps are. Common sense will dictate that what you see from the AMD sensor is virtually impossible unless you use liquid cooling.
    Also remember that the software in use may differ in readings slightly.
    The Fintek chip is reporting 2 CPU temps. I summise the higher as being the CPU core and the lower value as being a sensor in the vicinity of the CPU that MSI has added.
    Comparing the info with your HW Monitor, I further believe that TMPIN1 is the same as the Fintek CPU higher temp. TMPIN2 is the one for the lower CPU value in HWINFO and TMPIN0 is probably your southbridge.
    If you wish, run both these software packages at the same time and stress your machine in Prime95, Then you can monitor and figure out which ones are going up or down in unison. You may also find that the temps will be a lot closer then.

  • Higher than normal cpu for fed (PunjectRx) process

    I noticed on my 3850 that the CPU seems to have gone up overnight a fed days ago and has stayed there. Everything seems to be fine at the moment but I was just wondering what the process is that's causing it (google gives me nothing) and if I should be worried.
    Running show processes cpu sorted gives me this:
    Core 0: CPU utilization for five seconds: 15%; one minute: 18%;  five minutes: 25%
    Core 1: CPU utilization for five seconds: 97%; one minute: 45%;  five minutes: 34%
    Core 2: CPU utilization for five seconds: 15%; one minute: 51%;  five minutes: 39%
    Core 3: CPU utilization for five seconds: 10%; one minute: 20%;  five minutes: 42%
    PID    Runtime(ms) Invoked  uSecs  5Sec     1Min     5Min     TTY   Process
    5711   183846      14637156 217    27.84    27.34    27.31    1088  fed
    10184  481691      20810070 573    5.20     5.37     6.54     34816 iosd
    I asked for detailed info on the fed process and got the output below. As you'll notice, the high cpu value on the core doesn't always show up on the same core. What is that PunjectRx process that's responsible for the higher than normal value do?
    Core 0: CPU utilization for five seconds: 20%; one minute: 27%; five minutes: 30%
    Core 1: CPU utilization for five seconds: 18%; one minute: 24%; five minutes: 28%
    Core 2: CPU utilization for five seconds: 8%; one minute: 25%; five minutes: 34%
    Core 3: CPU utilization for five seconds: 92%; one minute: 70%; five minutes: 52%
    PID     T C  TID     Runtime(ms) Invoked   uSecs  5Sec   1Min 5Min TTY   Process
    5711    L            18656       146354252 217    26.9   27.2 27.3 1088  fed
    5711    L 3  5711    29060       7853      0      0.00   0.00 0.00 1088  fed
    5711    L 0  6144    2809206     23626670  0      0.00   0.01 0.02 1088  fed
    5711    L 1  6145    5570        313407    0      0.00   0.00 0.00 1088  fed
    5711    L 0  6146    296459      269367770 0      0.00   0.05 0.05 1088  CMI default xdm
    5711    L 0  6147    3270        209596    0      0.00   0.00 0.00 1088  fed
    5711    L 1  6150    2014171     254472866 0      0.34   0.30 0.29 0     fed-ots-main
    5711    L 2  6151    600         13111     0      0.00   0.00 0.00 0     fed-ots-mo
    5711    L 2  6153    3715892     3065842   0      0.48   0.48 0.48 0     fed-ots-nfl
    5711    L 0  6154    326140      18702233  0      0.00   0.00 0.00 0     fed
    5711    L 0  6155    137920      3126591   0      0.00   0.00 0.00 0     pdslib thread
    5711    L 0  6156    1820820     117290277 0      0.00   0.02 0.02 0     Timer
    5711    L 2  6157    0           2805      0      0.00   0.00 0.00 0     fed
    5711    L 0  6176    290660      152790809 0      0.72   0.77 0.73 0     IntrDrv
    5711    L 0  6179    486230      31194756  0      0.00   0.02 0.01 0     LED
    5711    L 0  10160   60          9427      0      0.00   0.00 0.00 0     Xcvr
    5711    L 0  10162   233781      204227456 0      0.24   0.24 0.24 0     Xcvr
    5711    L 2  10686   50780       1309757   0      0.00   0.00 0.00 0     PdsEvent
    5711    L 3  10687   2302060     113878739 0      24.0   24.0 24.0 0     PunjectRx
    5711    L 2  10688   2689529     198752351 0      1.15   1.34 1.39 0     PunjectTx
    5711    L 3  10689   0           7522      0      0.00   0.00 0.00 0     Consistency
    5711    L 2  10690   0           7522      0      0.00   0.00 0.00 0     ShFwd
    5711    L 0  10692   0           7544      0      0.00   0.00 0.00 0     eicore_bdn
    5711    L 0  10693   0           7544      0      0.00   0.00 0.00 0     eicore_bdn
    5711    L 0  10694   0           7544      0      0.00   0.00 0.00 0     eicore_bdn
    5711    L 0  10696   50          7599      0      0.00   0.00 0.00 0     eicore_ipc
    5711    L 3  10717   0           7752      0      0.00   0.00 0.00 0     fed
    5711    L 0  10952   0           7849      0      0.00   0.00 0.00 0     fed
    5711    L 0  11072   4281230     128013576 0      0.00   0.01 0.02 0     XcvrPoll

    Seeing similar here on 3850 stack. Running 03.03.01SE IOS-XE.
    Core 0: CPU utilization for five seconds: 45%; one minute: 40%; five minutes: 39%
    Core 1: CPU utilization for five seconds: 57%; one minute: 46%; five minutes: 45%
    Core 2: CPU utilization for five seconds: 58%; one minute: 57%; five minutes: 54%
    Core 3: CPU utilization for five seconds: 39%; one minute: 56%; five minutes: 56%
    PID     T C  TID     Runtime(ms) Invoked   uSecs  5Sec   1Min 5Min TTY   Process
    5679    L            2207615     162418091 66     23.7   23.1 22.7 1088  fed
    5679    L 2  5679    29940       7879      0      0.00   0.00 0.00 1088  fed
    5679    L 0  6112    321780      319764    0      0.00   0.03 0.04 1088  fed
    5679    L 2  6113    520         24080     0      0.00   0.00 0.00 1088  fed
    5679    L 2  6114    8770        5395188   0      0.00   0.03 0.04 0     CMI default xdm
    5679    L 1  6115    320         16534     0      0.00   0.00 0.00 0     fed
    5679    L 2  6118    1130370     5020432   0      0.62   0.74 0.74 0     fed-ots-main
    5679    L 1  6119    20          1303      0      0.00   0.00 0.00 0     fed-ots-mo
    5679    L 2  6121    3855140     224587    0      0.52   0.49 0.48 0     fed-ots-nfl
    5679    L 1  6122    23500       1399239   0      0.00   0.04 0.01 0     fed
    5679    L 2  6123    11430       231772    0      0.00   0.01 0.03 0     pdslib thread
    5679    L 1  6124    189270      9882134   0      0.05   0.04 0.04 0     Timer
    5679    L 1  6125    0           2808      0      0.00   0.00 0.00 0     fed
    5679    L 1  6144    793970      8150598   0      0.29   0.21 0.20 0     IntrDrv
    5679    L 1  6147    33730       2295636   0      0.00   0.01 0.00 0     LED
    5679    L 0  10452   40          9474      0      0.00   0.00 0.00 0     Xcvr
    5679    L 1  10456   1922330     107887089 0      0.33   0.22 0.20 0     Xcvr
    5679    L 3  12275   110         10697     0      0.00   0.00 0.00 0     PdsEvent
    5679    L 2  12276   980070      7963687   0      0.71   0.49 0.48 0     PunjectRx
    5679    L 0  12277   1263190     4878455   0      21.1   20.8 20.5 0     PunjectTx
    5679    L 0  12278   0           7567      0      0.00   0.00 0.00 0     Consistency
    5679    L 0  12279   0           7567      0      0.00   0.00 0.00 0     ShFwd
    5679    L 1  12283   0           7580      0      0.00   0.00 0.00 0     eicore_bdn
    5679    L 1  12284   0           7580      0      0.00   0.00 0.00 0     eicore_bdn
    5679    L 1  12285   0           7579      0      0.00   0.00 0.00 0     eicore_bdn
    5679    L 3  12289   10          7608      0      0.00   0.00 0.00 0     eicore_ipc
    5679    L 0  12298   0           7788      0      0.00   0.00 0.00 0     fed
    5679    L 2  12610   0           7875      0      0.00   0.00 0.00 0     fed
    5679    L 2  12801   233040      8635591   0      0.05   0.02 0.03 0     XcvrPoll

  • Performance problem - Tablespace Free Space

    Hi,
    Version 10204
    I am running the following statment in order to monitor tablespace free space.
    There are some tablespaces that i am not interesting to monitor , and i also whant to be alert
    only when less than 4 GB left in the tablespace.
    I build the following statment.
    Using the hint : /*+ NO_CPU_COSTING */ gave me the best performance but there are alot of time
    that its took to this statment few minute to run befor it finished.
    Could one help to improve its performance ?
    Please note that it performe even less good when i used the RULE hint or not using hint at all.
    SELECT  /*+ gather_plan_statistics */  'tablespace_free_space;'||to_char(pct_used,'999.99')||','||TBSNAME
    FROM( SELECT *
          FROM( SELECT NVL(b.tablespace_name, NVL(a.tablespace_name,'UNKOWN')) TBSNAME,
                       MBytes_alloc,
                           maxbytes,
                           MBytes_max,
                       ROUND(MBytes_alloc-NVL(MBytes_free,0),2) used,
                       ROUND(NVL(MBytes_free,0),2) free,
                       MBytes_free,
                       ROUND(DECODE( MBytes_max, 0,((MBytes_alloc-NVL(MBytes_free,0))/MBytes_alloc)*100,100*(MBytes_alloc) / maxbytes),2)PCT_USED
                FROM ( SELECT /*+ NO_CPU_COSTING */  SUM(bytes)/1024/1024 MBytes_free,
                              MAX(bytes)/1024/1024 largest,
                              tablespace_name
                       FROM   sys.DBA_FREE_SPACE
                       WHERE  TABLESPACE_NAME NOT IN
                              ('Q405_CALLS_TS','Q405_ICALLS_TS',
                               'Q305_CALLS_TS','Q305_ICALLS_TS',
                               'Q205_ICALLS_TS','Q306_CALLS_TS',
                               'Q406_CALLS_TS','Q206_CALLS_TS',
                               'Q205_CALLS_TS','Q105_CALLS_TS',
                               'Q105_ICALLS_TS','Q206_CALLS_TS','Q106_CALLS_TS',
                               'Q306_ICALLS_TS','Q107_ICALLS_TS','Q406_ICALLS_TS',
                               'Q206_ICALLS_TS','UNLMT_INTERNET_CALLS_2006_TS',
                               'UNLMT_INTERNET_CALLS_2007_TS',
                               'UNLMT_INTERNET_CALLS_2008_TS',
                               'Q107_ICALLS_TBS','Q107_CALLS_TBS',
                               'Q207_ICALLS_TBS','Q207_CALLS_TBS',
                               'Q307_ICALLS_TBS','Q307_CALLS_TBS',
                               'Q407_ICALLS_TBS','Q407_CALLS_TBS',
                               'Q408_ICALLS_TS','Q408_CALLS_TS',
                               'Q308_ICALLS_TS','Q308_CALLS_TS',
                               'Q208_ICALLS_TS','Q208_CALLS_TS',
                               'Q108_ICALLS_TS','Q108_CALLS_TS',
                               'Q109_ICALLS_TS','Q109_CALLS_TS',
                               'UNLMT_INT_CALLS_Q308_TS',
                               'UNLMT_INT_ICALLS_Q308_TS',
                               'UNLMT_INT_CALLS_Q408_TS',
                               'UNLMT_INT_ICALLS_Q408_TS'
                       GROUP BY tablespace_name ) a,
                     ( SELECT  SUM(bytes)/1024/1024 MBytes_alloc,
                              SUM(maxbytes)/1024/1024 MBytes_max,
                              SUM(DECODE (autoextensible,'YES',maxbytes/1024/1024,'NO', BYTES/1024/1024 )) maxbytes,
                              tablespace_name
                       FROM   DBA_DATA_FILES
                       WHERE  TABLESPACE_NAME NOT IN
                              ('Q405_CALLS_TS','Q405_ICALLS_TS',
                               'Q305_CALLS_TS','Q305_ICALLS_TS',
                               'Q205_ICALLS_TS','Q306_CALLS_TS',
                               'Q406_CALLS_TS','Q206_CALLS_TS',
                               'Q205_CALLS_TS','Q105_CALLS_TS',
                               'Q105_ICALLS_TS','Q206_CALLS_TS',
                               'Q106_CALLS_TS','Q306_ICALLS_TS',
                               'Q107_ICALLS_TS','Q406_ICALLS_TS',
                               'Q206_ICALLS_TS','UNLMT_INTERNET_CALLS_2006_TS',
                               'UNLMT_INTERNET_CALLS_2007_TS',
                               'UNLMT_INTERNET_CALLS_2008_TS',
                               'Q107_ICALLS_TBS','Q107_CALLS_TBS',
                               'Q207_ICALLS_TBS','Q207_CALLS_TBS',
                               'Q307_ICALLS_TBS','Q307_CALLS_TBS',
                               'Q407_ICALLS_TBS','Q407_CALLS_TBS',
                               'Q408_ICALLS_TS','Q408_CALLS_TS',
                               'Q308_ICALLS_TS','Q308_CALLS_TS',
                               'Q208_ICALLS_TS','Q208_CALLS_TS',
                               'Q108_ICALLS_TS','Q108_CALLS_TS',
                               'Q109_ICALLS_TS','Q109_CALLS_TS',
                               'UNLMT_INT_CALLS_Q308_TS',
                               'UNLMT_INT_ICALLS_Q308_TS',
                               'UNLMT_INT_CALLS_Q408_TS',
                               'UNLMT_INT_ICALLS_Q408_TS'
                       GROUP BY tablespace_name) b
                WHERE a.tablespace_name (+) = b.tablespace_name
                AND (a.MBytes_free<4000 or a.MBytes_free is null)
             ORDER BY PCT_USED DESC
    WHERE TBSNAME not in (select tablespace_name from dba_tablespaces where contents in ('UNDO'))
    and ROWNUM =1;
    select * from table(dbms_xplan.display_cursor('42hppgtx2h1gb',0,'ALLSTATS LAST'));
    Plan hash value: 2979461796
    PLAN_TABLE_OUTPUT
    | Id  | Operation                               | Name             | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
    |*  1 |  COUNT STOPKEY                          |                  |      1 |        |      1 |00:00:15.52 |     146K|   8927 |       |       |      |
    |*  2 |   FILTER                                |                  |      1 |        |      1 |00:00:15.52 |     146K|   8927 |       |       |      |
    |   3 |    VIEW                                 |                  |      1 |      3 |      1 |00:00:15.52 |     146K|   8927 |       |       |      |
    |   4 |     SORT ORDER BY                       |                  |      1 |      3 |      1 |00:00:15.52 |     146K|   8927 |  2048 |  2048 | 2048  (0)|
    |*  5 |      FILTER                             |                  |      1 |        |     16 |00:00:15.52 |     146K|   8927 |       |       |      |
    |*  6 |       HASH JOIN OUTER                   |                  |      1 |      3 |     25 |00:00:15.52 |     146K|   8927 |   561K|   561K|  982K (0)|
    |   7 |        VIEW                             |                  |      1 |      2 |     25 |00:00:02.95 |     105K|      0 |       |       |      |
    |   8 |         HASH GROUP BY                   |                  |      1 |      2 |     25 |00:00:02.95 |     105K|      0 |   447K|   447K|  977K (0)|
    |   9 |          VIEW                           | DBA_DATA_FILES   |      1 |      2 |    217 |00:00:03.25 |     105K|      0 |       |       |      |
    |  10 |           UNION-ALL                     |                  |      1 |        |    217 |00:00:03.25 |     105K|      0 |       |       |      |
    |  11 |            NESTED LOOPS                 |                  |      1 |      1 |      0 |00:00:00.67 |     219 |      0 |       |       |      |
    |  12 |             NESTED LOOPS                |                  |      1 |      1 |      0 |00:00:00.67 |     219 |      0 |       |       |      |
    |  13 |              MERGE JOIN CARTESIAN       |                  |      1 |      1 |  52297 |00:00:00.22 |       0 |      0 |       |       |      |
    |* 14 |               FIXED TABLE FULL          | X$KCCFN          |      1 |      1 |    217 |00:00:00.01 |       0 |      0 |       |       |      |
    |  15 |               BUFFER SORT               |                  |    217 |    100 |  52297 |00:00:00.06 |       0 |      0 | 11264 | 11264 |10240  (0)|
    |  16 |                FIXED TABLE FULL         | X$KCCFE          |      1 |    100 |    241 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 17 |              TABLE ACCESS BY INDEX ROWID| FILE$            |  52297 |      1 |      0 |00:00:00.52 |     219 |      0 |       |       |      |
    |* 18 |               INDEX UNIQUE SCAN         | I_FILE1          |  52297 |      1 |    217 |00:00:00.24 |       2 |      0 |       |       |      |
    |* 19 |             TABLE ACCESS CLUSTER        | TS$              |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 20 |              INDEX UNIQUE SCAN          | I_TS#            |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |  21 |            NESTED LOOPS                 |                  |      1 |      1 |    217 |00:00:02.58 |     105K|      0 |       |       |      |
    |  22 |             NESTED LOOPS                |                  |      1 |      1 |  52297 |00:00:01.89 |     104K|      0 |       |       |      |
    |  23 |              MERGE JOIN CARTESIAN       |                  |      1 |      1 |  52297 |00:00:00.22 |     217 |      0 |       |       |      |
    |  24 |               NESTED LOOPS              |                  |      1 |      1 |    217 |00:00:00.02 |     217 |      0 |       |       |      |
    |* 25 |                FIXED TABLE FULL         | X$KCCFN          |      1 |      1 |    217 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 26 |                FIXED TABLE FIXED INDEX  | X$KTFBHC (ind:1) |    217 |      1 |    217 |00:00:00.01 |     217 |      0 |       |       |      |
    |  27 |               BUFFER SORT               |                  |    217 |    100 |  52297 |00:00:00.11 |       0 |      0 | 11264 | 11264 |10240  (0)|
    |  28 |                FIXED TABLE FULL         | X$KCCFE          |      1 |    100 |    241 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 29 |              TABLE ACCESS CLUSTER       | TS$              |  52297 |      1 |  52297 |00:00:01.41 |     104K|      0 |       |       |      |
    |* 30 |               INDEX UNIQUE SCAN         | I_TS#            |  52297 |      1 |  52297 |00:00:00.37 |       2 |      0 |       |       |      |
    |* 31 |             TABLE ACCESS BY INDEX ROWID | FILE$            |  52297 |      1 |    217 |00:00:00.57 |     219 |      0 |       |       |      |
    |* 32 |              INDEX UNIQUE SCAN          | I_FILE1          |  52297 |      1 |    217 |00:00:00.28 |       2 |      0 |       |       |      |
    |  33 |        VIEW                             |                  |      1 |   1401 |     25 |00:00:12.56 |   40846 |   8927 |       |       |      |
    |  34 |         HASH GROUP BY                   |                  |      1 |   1401 |     25 |00:00:12.56 |   40846 |   8927 |   465K|   465K|  982K (0)|
    |  35 |          VIEW                           | DBA_FREE_SPACE   |      1 |   1401 |  73133 |00:00:14.19 |   40846 |   8927 |       |       |      |
    |  36 |           UNION-ALL                     |                  |      1 |        |  73133 |00:00:14.04 |   40846 |   8927 |       |       |      |
    |  37 |            NESTED LOOPS                 |                  |      1 |      1 |      0 |00:00:00.01 |      45 |      0 |       |       |      |
    |  38 |             NESTED LOOPS                |                  |      1 |      1 |      0 |00:00:00.01 |      45 |      0 |       |       |      |
    |  39 |              TABLE ACCESS FULL          | FET$             |      1 |      1 |      0 |00:00:00.01 |      45 |      0 |       |       |      |
    |* 40 |              INDEX UNIQUE SCAN          | I_FILE2          |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 41 |             TABLE ACCESS CLUSTER        | TS$              |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |  42 |            NESTED LOOPS                 |                  |      1 |      5 |   7271 |00:00:00.20 |    1156 |      0 |       |       |      |
    |  43 |             NESTED LOOPS                |                  |      1 |      6 |   7271 |00:00:00.14 |    1154 |      0 |       |       |      |
    |* 44 |              TABLE ACCESS FULL          | TS$              |      1 |      2 |     25 |00:00:00.01 |      45 |      0 |       |       |      |
    |* 45 |              FIXED TABLE FIXED INDEX    | X$KTFBFE (ind:1) |     25 |      3 |   7271 |00:00:00.11 |    1109 |      0 |       |       |      |
    |* 46 |             INDEX UNIQUE SCAN           | I_FILE2          |   7271 |      1 |   7271 |00:00:00.04 |       2 |      0 |       |       |      |
    |  47 |            NESTED LOOPS                 |                  |      1 |   1394 |  65862 |00:00:17.73 |   39476 |   8927 |       |       |      |
    |  48 |             NESTED LOOPS                |                  |      1 |  30528 |  65862 |00:00:16.94 |   39474 |   8927 |       |       |      |
    |* 49 |              HASH JOIN                  |                  |      1 |   2540 |   8927 |00:00:00.03 |      90 |      0 |   811K|   811K| 1397K (0)|
    |  50 |               TABLE ACCESS FULL         | RECYCLEBIN$      |      1 |   8319 |   8935 |00:00:00.01 |      45 |      0 |       |       |      |
    |* 51 |               TABLE ACCESS FULL         | TS$              |      1 |      2 |     25 |00:00:00.01 |      45 |      0 |       |       |      |
    |* 52 |              FIXED TABLE FIXED INDEX    | X$KTFBUE (ind:1) |   8927 |     12 |  65862 |00:00:11.66 |   39384 |   8927 |       |       |      |
    |* 53 |             INDEX UNIQUE SCAN           | I_FILE2          |  65862 |      1 |  65862 |00:00:00.45 |       2 |      0 |       |       |      |
    |* 54 |            TABLE ACCESS BY INDEX ROWID  | RECYCLEBIN$      |      1 |      1 |      0 |00:00:00.01 |     169 |      0 |       |       |      |
    |  55 |             NESTED LOOPS                |                  |      1 |      1 |      1 |00:00:00.01 |     169 |      0 |       |       |      |
    |  56 |              NESTED LOOPS               |                  |      1 |      1 |      0 |00:00:00.01 |     169 |      0 |       |       |      |
    |  57 |               NESTED LOOPS              |                  |      1 |      1 |      0 |00:00:00.01 |     169 |      0 |       |       |      |
    |  58 |                TABLE ACCESS FULL        | UET$             |      1 |      1 |      0 |00:00:00.01 |     169 |      0 |       |       |      |
    |* 59 |                INDEX UNIQUE SCAN        | I_FILE2          |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 60 |               TABLE ACCESS CLUSTER      | TS$              |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 61 |                INDEX UNIQUE SCAN        | I_TS#            |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 62 |              INDEX RANGE SCAN           | RECYCLEBIN$_TS   |      0 |   1188 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 63 |    TABLE ACCESS FULL                    | TS$              |      1 |      1 |      0 |00:00:00.01 |      45 |      0 |       |       |      |
    Predicate Information (identified by operation id):
       1 - filter(ROWNUM=1)
       2 - filter( IS NULL)
       5 - filter(("A"."MBYTES_FREE"<4000 OR "A"."MBYTES_FREE" IS NULL))
       6 - access("A"."TABLESPACE_NAME"="B"."TABLESPACE_NAME")
      14 - filter(("INST_ID"=USERENV('INSTANCE') AND "FNNAM" IS NOT NULL AND BITAND("FNFLG",4)<>4 AND "FNTYP"=4))
    PLAN_TABLE_OUTPUT
      17 - filter(("F"."SPARE1" IS NULL AND "F"."TS#" IS NOT NULL))
      18 - access("FE"."FENUM"="F"."FILE#")
           filter("FNFNO"="F"."FILE#")
      19 - filter(("TS"."NAME"<>'Q405_CALLS_TS' AND "TS"."NAME"<>'Q405_ICALLS_TS' ... AND "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
      20 - access("F"."TS#"="TS"."TS#")
      25 - filter(("INST_ID"=USERENV('INSTANCE') AND "FNNAM" IS NOT NULL AND BITAND("FNFLG",4)<>4 AND "FNTYP"=4))
      26 - filter("FNFNO"="HC"."KTFBHCAFNO")
      29 - filter(("TS"."NAME"<>'Q405_CALLS_TS' AND "TS"."NAME"<>'Q405_ICALLS_TS' AND ... AND "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
      30 - access("HC"."KTFBHCTSN"="TS"."TS#")
      31 - filter("F"."SPARE1" IS NOT NULL)
      32 - access("FE"."FENUM"="F"."FILE#")
           filter("FNFNO"="F"."FILE#")
      40 - access("F"."TS#"="FI"."TS#" AND "F"."FILE#"="FI"."RELFILE#")
    PLAN_TABLE_OUTPUT
           filter(("FI"."TS#" IS NOT NULL AND "FI"."RELFILE#" IS NOT NULL))
      41 - filter(("TS"."TS#"="F"."TS#" AND "TS"."BITMAPPED"=0 AND "TS"."NAME"<>'Q405_CALLS_TS' AND "TS"."NAME"<>'Q405_ICALLS_TS' AND
                  "TS"."NAME"<>'Q305_CALLS_TS' AND "TS"."NAME"<>'Q305_ICALLS_TS' AND ... "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
      44 - filter(("TS"."BITMAPPED"<>0 AND INTERNAL_FUNCTION("TS"."ONLINE$") AND .... "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
      45 - filter("TS"."TS#"="F"."KTFBFETSN")
      46 - access("F"."KTFBFETSN"="FI"."TS#" AND "F"."KTFBFEFNO"="FI"."RELFILE#")
           filter(("FI"."TS#" IS NOT NULL AND "FI"."RELFILE#" IS NOT NULL))
      49 - access("TS"."TS#"="RB"."TS#")
      51 - filter(("TS"."BITMAPPED"<>0 AND INTERNAL_FUNCTION("TS"."ONLINE$") AND...."TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
      52 - filter(("U"."KTFBUESEGTSN"="RB"."TS#" AND "U"."KTFBUESEGFNO"="RB"."FILE#" AND "U"."KTFBUESEGBNO"="RB"."BLOCK#"))
      53 - access("RB"."TS#"="FI"."TS#" AND "U"."KTFBUEFNO"="FI"."RELFILE#")
           filter(("FI"."TS#" IS NOT NULL AND "FI"."RELFILE#" IS NOT NULL))
    PLAN_TABLE_OUTPUT
      54 - filter(("U"."SEGFILE#"="RB"."FILE#" AND "U"."SEGBLOCK#"="RB"."BLOCK#"))
      59 - access("U"."TS#"="FI"."TS#" AND "U"."SEGFILE#"="FI"."RELFILE#")
           filter(("FI"."TS#" IS NOT NULL AND "FI"."RELFILE#" IS NOT NULL))
      60 - filter(("TS"."BITMAPPED"=0 AND "TS"."NAME"<>'Q405_CALLS_TS' AND .... AND "TS"."NAME"<>'UNLMT_INT_CALLS_Q408_TS' AND
                  "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
      61 - access("TS"."TS#"="U"."TS#")
      62 - access("U"."TS#"="RB"."TS#")
      63 - filter((DECODE("TS"."CONTENTS$",0,DECODE(BITAND("TS"."FLAGS",16),16,'UNDO','PERMANENT'),1,'TEMPORARY')='UNDO' AND "TS"."ONLINE$"<>3 AND
                  BITAND("FLAGS",2048)<>2048 AND LNNVL("TS"."NAME"<>:B1)))
    Note
    PLAN_TABLE_OUTPUT
       - cpu costing is off (consider enabling it)

    Version 10204
    I am running the following statment in order to monitor tablespace free space.
    There are some tablespaces that i am not interesting to monitor , and i also whant to be alert
    only when less than 4 GB left in the tablespace.
    And just adding to Dan's reply, if you are on 10g as you mentioned, why not to use the built in Alert mechanism to monitor and get alerts about the tablespace usage using the GC or Database Console than creating a home grown solution like the one you have posted?
    Aman....

  • Sql Query is running fine in one database but running from long in other

    Hi All,
    Please advice me on below:
    One query is running fine on 11gr2 database with having 2GB SGA and cost of the running query is 15, but the same query is running from long time in other database having same 2GB SGA.
    Below is teh Query:
    SELECT CDU.USER_NAME, DECODE(:B2 , 'QUEUE','begin
    dbms_aqadm.grant_queue_privilege(''ALL'','''||:B1
    ||''','''||CDU.USER_NAME||''',true); end;', 'grant '||DECODE(:B2 ,
    'TABLE','SELECT,INSERT,UPDATE,DELETE'||DECODE(CDU.ADMIN,'Y',',REFERENCES
    ',''), 'VIEW',DECODE(:B3 ,NULL,'SELECT','SELECT,INSERT,UPDATE,DELETE'||D
    ECODE(CDU.ADMIN,'Y',',REFERENCES','')), 'TYPE','EXECUTE',
    'SEQUENCE','SELECT', 'EXECUTE')||' on
    '||PACK_UTILS.GET_SCHEMA_OWNER||'.'||:B1 ||' to
    "'||CDU.USER_NAME||'"'||DECODE(CDU.ADMIN,'Y',' WITH GRANT OPTION',''))
    AS GRANT_SOURCE, 'create or replace synonym
    "'||CDU.USER_NAME||'"."'||:B1 ||'" for
    "'||PACK_UTILS.GET_SCHEMA_OWNER||'"."'||:B1 ||'"' AS SYNONYM_SOURCE,
    NVL2( S.TABLE_NAME, 'Y', 'N' ) SYNONYM_EXISTS FROM CD_USERS CDU,
    ALL_SYNONYMS S, ALL_USERS U WHERE :B2 IN
    ('TYPE','TABLE','VIEW','FUNCTION','PROCEDURE','PACKAGE','SEQUENCE','QUEU
    E','SYNONYM') AND CDU.USER_TYPE = 'S' AND CDU.USER_NAME = U.USERNAME
    AND CDU.USER_NAME = S.OWNER AND :B1 = S.TABLE_NAME
    Please advise me as application team is chasing me like anything. what I can find out is that Cost is different in both databases.

    Sorry forr Late reply friends..
    below are the Explian plans for both databases:
                                                      BAD database
    PLAN_TABLE_OUTPUT
    SQL_ID  3bp3rynsds42r, child number 0
    SELECT CDU.USER_NAME, DECODE(:B2 , 'QUEUE','begin
    dbms_aqadm.grant_queue_privilege(''ALL'','''||:B1
    ||''','''||CDU.USER_NAME||''',true); end;', 'grant '||DECODE(:B2 ,
    'TABLE','SELECT,INSERT,UPDATE,DELETE'||DECODE(CDU.ADMIN,'Y',',REFERENCES
    ',''), 'VIEW',DECODE(:B3 ,NULL,'SELECT','SELECT,INSERT,UPDATE,DELETE'||D
    ECODE(CDU.ADMIN,'Y',',REFERENCES','')), 'TYPE','EXECUTE',
    'SEQUENCE','SELECT', 'EXECUTE')||' on
    '||PACK_UTILS.GET_SCHEMA_OWNER||'.'||:B1 ||' to
    "'||CDU.USER_NAME||'"'||DECODE(CDU.ADMIN,'Y',' WITH GRANT OPTION',''))
    PLAN_TABLE_OUTPUT
    AS GRANT_SOURCE, 'create or replace synonym
    "'||CDU.USER_NAME||'"."'||:B1 ||'" for
    "'||PACK_UTILS.GET_SCHEMA_OWNER||'"."'||:B1 ||'"' AS SYNONYM_SOURCE,
    NVL2( S.TABLE_NAME, 'Y', 'N' ) SYNONYM_EXISTS FROM CD_USERS CDU,
    ALL_SYNONYMS S, ALL_USERS U WHERE :B2 IN
    ('TYPE','TABLE','VIEW','FUNCTION','PROCEDURE','PACKAGE','SEQUENCE','QUEU
    E','SYNONYM') AND CDU.USER_TYPE = 'S' AND CDU.USER_NAME = U.USERNAME
    AND CDU.USER_NAME = S.OWNER AND :B1 = S.TABLE_NAME
    Plan hash value: 2404940060
    PLAN_TABLE_OUTPUT
    | Id  | Operation                                            | Name               | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                                     |                    |       |       |       |    94 (100)|          |
    |*  1 |  FILTER                                              |                    |       |       |       |            |          |
    |*  2 |   HASH JOIN                                          |                    |    81 |  6723 |       |    94   (0)| 00:00:01 |
    |   3 |    NESTED LOOPS OUTER                                |                    |    81 |  6480 |       |    91   (0)| 00:00:01 |
    |*  4 |     HASH JOIN                                        |                    |    81 |  3726 |       |    10   (0)| 00:00:01 |
    |*  5 |      HASH JOIN                                       |                    |   137 |  3699 |       |     7   (0)| 00:00:01 |
    |   6 |       TABLE ACCESS FULL                              | TS$                |     7 |    21 |       |     3   (0)| 00:00:01 |
    |*  7 |       TABLE ACCESS FULL                              | USER$              |   137 |  3288 |       |     4   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |*  8 |      TABLE ACCESS FULL                               | CD_USERS           |    82 |  1558 |       |     3   (0)| 00:00:01 |
    |   9 |     VIEW                                             | ALL_SYNONYMS       |     1 |    34 |       |     1   (0)| 00:00:01 |
    |  10 |      SORT UNIQUE                                     |                    |       |       |       |            |          |
    |  11 |       UNION-ALL PARTITION                            |                    |       |       |       |            |          |
    |* 12 |        FILTER                                        |                    |       |       |       |            |          |
    |  13 |         NESTED LOOPS                                 |                    |     1 |   116 |       |    60   (0)| 00:00:01 |
    |  14 |          NESTED LOOPS                                |                    |     1 |    94 |       |    59   (0)| 00:00:01 |
    |  15 |           NESTED LOOPS                               |                    |    12 |   684 |       |    23   (0)| 00:00:01 |
    |  16 |            TABLE ACCESS BY INDEX ROWID               | USER$              |     1 |    19 |       |     1   (0)| 00:00:01 |
    |* 17 |             INDEX UNIQUE SCAN                        | I_USER1            |     1 |       |       |     0   (0)|          |
    |  18 |            TABLE ACCESS BY INDEX ROWID               | SYN$               |    12 |   456 |       |    22   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |* 19 |             INDEX SKIP SCAN                          | I_SYN2             |    12 |       |       |    12   (0)| 00:00:01 |
    |* 20 |           TABLE ACCESS BY INDEX ROWID                | OBJ$               |     1 |    37 |       |     3   (0)| 00:00:01 |
    |* 21 |            INDEX RANGE SCAN                          | I_OBJ1             |     1 |       |       |     2   (0)| 00:00:01 |
    |* 22 |          INDEX RANGE SCAN                            | I_USER2            |     1 |    22 |       |     1   (0)| 00:00:01 |
    |* 23 |         FIXED TABLE FULL                             | X$KZSPR            |    17 |   119 |       |     0   (0)|          |
    |* 24 |         FILTER                                       |                    |       |       |       |            |          |
    |* 25 |          FILTER                                      |                    |       |       |       |            |          |
    |  26 |           NESTED LOOPS                               |                    |    27 |  2430 |       |     6   (0)| 00:00:01 |
    |  27 |            NESTED LOOPS                              |                    |     1 |    78 |       |     4   (0)| 00:00:01 |
    |  28 |             NESTED LOOPS                             |                    |     1 |    56 |       |     3   (0)| 00:00:01 |
    |  29 |              TABLE ACCESS BY INDEX ROWID             | USER$              |     1 |    19 |       |     1   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |* 30 |               INDEX UNIQUE SCAN                      | I_USER1            |     1 |       |       |     0   (0)|          |
    |* 31 |              INDEX RANGE SCAN                        | I_OBJ5             |     1 |    37 |       |     2   (0)| 00:00:01 |
    |* 32 |             INDEX RANGE SCAN                         | I_USER2            |     1 |    22 |       |     1   (0)| 00:00:01 |
    |* 33 |            INDEX RANGE SCAN                          | I_OBJAUTH1         |    28 |   336 |       |     2   (0)| 00:00:01 |
    |* 34 |          FIXED TABLE FULL                            | X$KZSRO            |     1 |     3 |       |     0   (0)|          |
    |  35 |          NESTED LOOPS                                |                    |     1 |    30 |       |     3   (0)| 00:00:01 |
    |* 36 |           INDEX SKIP SCAN                            | I_USER2            |     1 |    20 |       |     1   (0)| 00:00:01 |
    |* 37 |           INDEX RANGE SCAN                           | I_OBJ4             |     1 |    10 |       |     2   (0)| 00:00:01 |
    |  38 |         NESTED LOOPS                                 |                    |     1 |    30 |       |     3   (0)| 00:00:01 |
    |* 39 |          INDEX SKIP SCAN                             | I_USER2            |     1 |    20 |       |     1   (0)| 00:00:01 |
    |* 40 |          INDEX RANGE SCAN                            | I_OBJ4             |     1 |    10 |       |     2   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |* 41 |        FILTER                                        |                    |       |       |       |            |          |
    |  42 |         NESTED LOOPS                                 |                    |     1 |   129 |       |  4301   (2)| 00:00:39 |
    |  43 |          NESTED LOOPS                                |                    |     1 |   129 |       |  4301   (2)| 00:00:39 |
    |  44 |           NESTED LOOPS                               |                    |     1 |    91 |       |  4299   (2)| 00:00:39 |
    |  45 |            NESTED LOOPS                              |                    |     1 |    69 |       |  4298   (2)| 00:00:39 |
    |  46 |             NESTED LOOPS                             |                    |     2 |    64 |       |  4292   (2)| 00:00:39 |
    |  47 |              TABLE ACCESS BY INDEX ROWID             | USER$              |     1 |    19 |       |     1   (0)| 00:00:01 |
    |* 48 |               INDEX UNIQUE SCAN                      | I_USER1            |     1 |       |       |     0   (0)|          |
    |  49 |              VIEW                                    | _ALL_SYNONYMS_TREE |     2 |    26 |       |  4291   (2)| 00:00:39 |
    |* 50 |               CONNECT BY NO FILTERING WITH START-WITH|                    |       |       |       |            |          |
    |* 51 |                FILTER                                |                    |       |       |       |            |          |
    PLAN_TABLE_OUTPUT
    |* 52 |                 HASH JOIN                            |                    | 18370 |  2080K|       |  4291   (2)| 00:00:39 |
    |  53 |                  INDEX FULL SCAN                     | I_USER2            |   207 |  4554 |       |     1   (0)| 00:00:01 |
    |* 54 |                  HASH JOIN                           |                    | 18370 |  1686K|       |  4290   (2)| 00:00:39 |
    |  55 |                   TABLE ACCESS FULL                  | USER$              |   207 |  3933 |       |     4   (0)| 00:00:01 |
    |* 56 |                   HASH JOIN                          |                    |  2922K|   209M|    18M|  4269   (1)| 00:00:39 |
    |* 57 |                    INDEX FAST FULL SCAN              | I_OBJ2             |   387K|    13M|       |  1323   (1)| 00:00:12 |
    |  58 |                    TABLE ACCESS FULL                 | SYN$               |   400K|    14M|       |   566   (2)| 00:00:06 |
    |  59 |                 NESTED LOOPS                         |                    |     1 |    30 |       |     3   (0)| 00:00:01 |
    |* 60 |                  INDEX SKIP SCAN                     | I_USER2            |     1 |    20 |       |     1   (0)| 00:00:01 |
    |* 61 |                  INDEX RANGE SCAN                    | I_OBJ4             |     1 |    10 |       |     2   (0)| 00:00:01 |
    |* 62 |                FILTER                                |                    |       |       |       |            |          |
    PLAN_TABLE_OUTPUT
    |  63 |                 TABLE ACCESS BY INDEX ROWID          | SYN$               |     1 |    38 |       |     3   (0)| 00:00:01 |
    |* 64 |                  INDEX UNIQUE SCAN                   | I_SYN1             |     1 |       |       |     2   (0)| 00:00:01 |
    |* 65 |                 FILTER                               |                    |       |       |       |            |          |
    |* 66 |                  FILTER                              |                    |       |       |       |            |          |
    |  67 |                   NESTED LOOPS                       |                    |    27 |  2430 |       |     6   (0)| 00:00:01 |
    |  68 |                    NESTED LOOPS                      |                    |     1 |    78 |       |     4   (0)| 00:00:01 |
    |  69 |                     NESTED LOOPS                     |                    |     1 |    56 |       |     3   (0)| 00:00:01 |
    |  70 |                      TABLE ACCESS BY INDEX ROWID     | USER$              |     1 |    19 |       |     1   (0)| 00:00:01 |
    |* 71 |                       INDEX UNIQUE SCAN              | I_USER1            |     1 |       |       |     0   (0)|          |
    |* 72 |                      INDEX RANGE SCAN                | I_OBJ5             |     1 |    37 |       |     2   (0)| 00:00:01 |
    |* 73 |                     INDEX RANGE SCAN                 | I_USER2            |     1 |    22 |       |     1   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |* 74 |                    INDEX RANGE SCAN                  | I_OBJAUTH1         |    28 |   336 |       |     2   (0)| 00:00:01 |
    |* 75 |                  FIXED TABLE FULL                    | X$KZSRO            |     1 |     3 |       |     0   (0)|          |
    |  76 |                  NESTED LOOPS                        |                    |     1 |    30 |       |     3   (0)| 00:00:01 |
    |* 77 |                   INDEX SKIP SCAN                    | I_USER2            |     1 |    20 |       |     1   (0)| 00:00:01 |
    |* 78 |                   INDEX RANGE SCAN                   | I_OBJ4             |     1 |    10 |       |     2   (0)| 00:00:01 |
    |* 79 |                 FIXED TABLE FULL                     | X$KZSPR            |    17 |   119 |       |     0   (0)|          |
    |* 80 |             TABLE ACCESS BY INDEX ROWID              | OBJ$               |     1 |    37 |       |     3   (0)| 00:00:01 |
    |* 81 |              INDEX RANGE SCAN                        | I_OBJ1             |     1 |       |       |     2   (0)| 00:00:01 |
    |* 82 |            INDEX RANGE SCAN                          | I_USER2            |     1 |    22 |       |     1   (0)| 00:00:01 |
    |* 83 |           INDEX UNIQUE SCAN                          | I_SYN1             |     1 |       |       |     1   (0)| 00:00:01 |
    |* 84 |          TABLE ACCESS BY INDEX ROWID                 | SYN$               |     1 |    38 |       |     2   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |  85 |         NESTED LOOPS                                 |                    |     1 |    30 |       |     3   (0)| 00:00:01 |
    |* 86 |          INDEX SKIP SCAN                             | I_USER2            |     1 |    20 |       |     1   (0)| 00:00:01 |
    |* 87 |          INDEX RANGE SCAN                            | I_OBJ4             |     1 |    10 |       |     2   (0)| 00:00:01 |
    |  88 |    TABLE ACCESS FULL                                 | TS$                |     7 |    21 |       |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter((:B2='TYPE' OR :B2='TABLE' OR :B2='VIEW' OR :B2='FUNCTION' OR :B2='PROCEDURE' OR :B2='PACKAGE' OR
                  :B2='SEQUENCE' OR :B2='QUEUE' OR :B2='SYNONYM'))
    PLAN_TABLE_OUTPUT
       2 - access("U"."TEMPTS#"="TTS"."TS#")
       4 - access("CDU"."USER_NAME"="U"."NAME")
       5 - access("U"."DATATS#"="DTS"."TS#")
       7 - filter("U"."TYPE#"=1)
       8 - filter("CDU"."USER_TYPE"='S')
      12 - filter(((INTERNAL_FUNCTION("O"."SPARE3") OR ("S"."NODE" IS NULL AND  IS NOT NULL) OR  IS NOT NULL) AND
                  (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND
                  "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND
                  "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR (SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND
                  "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR  IS NOT
                  NULL)))
    PLAN_TABLE_OUTPUT
      17 - access("U"."NAME"="CDU"."USER_NAME")
      19 - access("S"."NAME"=:B1)
           filter("S"."NAME"=:B1)
      20 - filter("O"."SPARE3"="U"."USER#")
      21 - access("O"."OBJ#"="S"."OBJ#" AND "O"."TYPE#"=5)
           filter("O"."TYPE#"=5)
      22 - access("O"."OWNER#"="U"."USER#")
      23 - filter((((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR
                  (-"KZSPRPRV")=(-50)) AND "INST_ID"=USERENV('INSTANCE')))
      24 - filter((("BA"."GRANTOR#"=USERENV('SCHEMAID') OR  IS NOT NULL) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND
                  "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
    PLAN_TABLE_OUTPUT
                  "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR
                  BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND
                  ((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
                  "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR  IS NOT NULL)))))
      25 - filter(:B1 IS NULL)
      30 - access("BU"."NAME"=:B1)
      31 - access("BU"."USER#"="O"."SPARE3" AND "O"."NAME"=:B1)
      32 - access("O"."OWNER#"="U"."USER#")
      33 - access("BA"."OBJ#"="O"."OBJ#")
      34 - filter("KZSROROL"=:B1)
      36 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
    PLAN_TABLE_OUTPUT
           filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
      37 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
      39 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
           filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
      40 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
      41 - filter((("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND
                  "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND
                  "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR
                  (SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
                  "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR  IS NOT NULL))
      48 - access("U"."NAME"="CDU"."USER_NAME")
    PLAN_TABLE_OUTPUT
      50 - access("S"."BASE_SYN_ID"=PRIOR NULL)
           filter( IS NOT NULL)
      51 - filter((("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND
                  "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND
                  "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR
                  (SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
                  "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR  IS NOT NULL))
      52 - access("O"."OWNER#"="U"."USER#")
      54 - access("S"."OWNER"="BU"."NAME" AND "BU"."USER#"="O"."SPARE3")
      56 - access("S"."NAME"="O"."NAME")
      57 - filter("O"."TYPE#"=5)
    PLAN_TABLE_OUTPUT
      60 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
           filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
      61 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
      62 - filter(( IS NOT NULL OR ("S"."NODE" IS NULL AND  IS NOT NULL)))
      64 - access("S"."OBJ#"=:B1)
      65 - filter((("BA"."GRANTOR#"=USERENV('SCHEMAID') OR  IS NOT NULL) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND
                  "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
                  "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR
                  BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND
                  ((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
                  "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR  IS NOT NULL)))))
    PLAN_TABLE_OUTPUT
      66 - filter(:B1 IS NULL)
      71 - access("BU"."NAME"=:B1)
      72 - access("BU"."USER#"="O"."SPARE3" AND "O"."NAME"=:B1)
      73 - access("O"."OWNER#"="U"."USER#")
      74 - access("BA"."OBJ#"="O"."OBJ#")
      75 - filter("KZSROROL"=:B1)
      77 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
           filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
      78 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
      79 - filter((((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR
                  (-"KZSPRPRV")=(-50)) AND "INST_ID"=USERENV('INSTANCE')))
    PLAN_TABLE_OUTPUT
      80 - filter("O"."SPARE3"="U"."USER#")
      81 - access("O"."OBJ#"="ST"."SYN_ID" AND "O"."TYPE#"=5)
           filter("O"."TYPE#"=5)
      82 - access("O"."OWNER#"="U"."USER#")
      83 - access("S"."OBJ#"="ST"."SYN_ID")
           filter("O"."OBJ#"="S"."OBJ#")
      84 - filter("S"."NAME"=:B1)
      86 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
           filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
      87 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
    209 rows selected
    ==============================================================================================
                                                                     Good one
    PLAN_TABLE_OUTPUT
    SQL_ID  3bp3rynsds42r, child number 0
    SELECT CDU.USER_NAME, DECODE(:B2 , 'QUEUE','begin
    dbms_aqadm.grant_queue_privilege(''ALL'','''||:B1
    ||''','''||CDU.USER_NAME||''',true); end;', 'grant '||DECODE(:B2 ,
    'TABLE','SELECT,INSERT,UPDATE,DELETE'||DECODE(CDU.ADMIN,'Y',',REFERENCES
    ',''), 'VIEW',DECODE(:B3 ,NULL,'SELECT','SELECT,INSERT,UPDATE,DELETE'||D
    ECODE(CDU.ADMIN,'Y',',REFERENCES','')), 'TYPE','EXECUTE',
    'SEQUENCE','SELECT', 'EXECUTE')||' on
    '||PACK_UTILS.GET_SCHEMA_OWNER||'.'||:B1 ||' to
    "'||CDU.USER_NAME||'"'||DECODE(CDU.ADMIN,'Y',' WITH GRANT OPTION',''))
    PLAN_TABLE_OUTPUT
    AS GRANT_SOURCE, 'create or replace synonym
    "'||CDU.USER_NAME||'"."'||:B1 ||'" for
    "'||PACK_UTILS.GET_SCHEMA_OWNER||'"."'||:B1 ||'"' AS SYNONYM_SOURCE,
    NVL2( S.TABLE_NAME, 'Y', 'N' ) SYNONYM_EXISTS FROM CD_USERS CDU,
    ALL_SYNONYMS S, ALL_USERS U WHERE :B2 IN
    ('TYPE','TABLE','VIEW','FUNCTION','PROCEDURE','PACKAGE','SEQUENCE','QUEU
    E','SYNONYM') AND CDU.USER_TYPE = 'S' AND CDU.USER_NAME = U.USERNAME
    AND CDU.USER_NAME = S.OWNER AND :B1 = S.TABLE_NAME
    Plan hash value: 2146531909
    PLAN_TABLE_OUTPUT
    | Id  | Operation                                          | Name               | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                                   |                    |       |       |       |    15 (100)|          |
    |*  1 |  FILTER                                            |                    |       |       |       |            |          |
    |   2 |   NESTED LOOPS OUTER                               |                    |     3 |   273 |       |    15   (0)| 00:00:01 |
    |   3 |    NESTED LOOPS                                    |                    |     3 |   153 |       |    12   (0)| 00:00:01 |
    |   4 |     NESTED LOOPS                                   |                    |     3 |   144 |       |     9   (0)| 00:00:01 |
    |   5 |      NESTED LOOPS                                  |                    |     3 |   135 |       |     6   (0)| 00:00:01 |
    |*  6 |       TABLE ACCESS FULL                            | USER$              |    55 |  1375 |       |     4   (0)| 00:00:01 |
    |*  7 |       TABLE ACCESS BY INDEX ROWID                  | CD_USERS           |     1 |    20 |       |     1   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |*  8 |        INDEX UNIQUE SCAN                           | I1_CD_USERS        |     1 |       |       |     0   (0)|          |
    |   9 |      TABLE ACCESS CLUSTER                          | TS$                |     1 |     3 |       |     1   (0)| 00:00:01 |
    |* 10 |       INDEX UNIQUE SCAN                            | I_TS#              |     1 |       |       |     0   (0)|          |
    |  11 |     TABLE ACCESS CLUSTER                           | TS$                |     1 |     3 |       |     1   (0)| 00:00:01 |
    |* 12 |      INDEX UNIQUE SCAN                             | I_TS#              |     1 |       |       |     0   (0)|          |
    |  13 |    VIEW                                            | ALL_SYNONYMS       |     1 |    40 |       |     1   (0)| 00:00:01 |
    |  14 |     SORT UNIQUE                                    |                    |       |       |       |            |          |
    |  15 |      UNION-ALL PARTITION                           |                    |       |       |       |            |          |
    |* 16 |       FILTER                                       |                    |       |       |       |            |          |
    |  17 |        NESTED LOOPS                                |                    |     1 |   116 |       |    19   (0)| 00:00:01 |
    |  18 |         NESTED LOOPS                               |                    |     1 |    94 |       |    18   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |  19 |          NESTED LOOPS                              |                    |     1 |    56 |       |    15   (0)| 00:00:01 |
    |  20 |           TABLE ACCESS BY INDEX ROWID              | USER$              |     1 |    20 |       |     1   (0)| 00:00:01 |
    |* 21 |            INDEX UNIQUE SCAN                       | I_USER1            |     1 |       |       |     0   (0)|          |
    |  22 |           TABLE ACCESS BY INDEX ROWID              | SYN$               |     1 |    36 |       |    14   (0)| 00:00:01 |
    |* 23 |            INDEX SKIP SCAN                         | I_SYN2             |     1 |       |       |    12   (0)| 00:00:01 |
    |* 24 |          TABLE ACCESS BY INDEX ROWID               | OBJ$               |     1 |    38 |       |     3   (0)| 00:00:01 |
    |* 25 |           INDEX RANGE SCAN                         | I_OBJ1             |     1 |       |       |     2   (0)| 00:00:01 |
    |* 26 |         INDEX RANGE SCAN                           | I_USER2            |     1 |    22 |       |     1   (0)| 00:00:01 |
    |* 27 |        FIXED TABLE FULL                            | X$KZSPR            |    17 |   119 |       |     0   (0)|          |
    |* 28 |        FILTER                                      |                    |       |       |       |            |          |
    |* 29 |         FILTER                                     |                    |       |       |       |            |          |
    PLAN_TABLE_OUTPUT
    |  30 |          NESTED LOOPS                              |                    |     3 |   279 |       |     5   (0)| 00:00:01 |
    |  31 |           NESTED LOOPS                             |                    |     1 |    80 |       |     4   (0)| 00:00:01 |
    |  32 |            NESTED LOOPS                            |                    |     1 |    58 |       |     3   (0)| 00:00:01 |
    |  33 |             TABLE ACCESS BY INDEX ROWID            | USER$              |     1 |    20 |       |     1   (0)| 00:00:01 |
    |* 34 |              INDEX UNIQUE SCAN                     | I_USER1            |     1 |       |       |     0   (0)|          |
    |* 35 |             INDEX RANGE SCAN                       | I_OBJ5             |     1 |    38 |       |     2   (0)| 00:00:01 |
    |* 36 |            INDEX RANGE SCAN                        | I_USER2            |     1 |    22 |       |     1   (0)| 00:00:01 |
    |* 37 |           INDEX RANGE SCAN                         | I_OBJAUTH1         |     3 |    39 |       |     1   (0)| 00:00:01 |
    |* 38 |         FIXED TABLE FULL                           | X$KZSRO            |     1 |     3 |       |     0   (0)|          |
    |  39 |         NESTED LOOPS                               |                    |     1 |    32 |       |     3   (0)| 00:00:01 |
    |* 40 |          INDEX SKIP SCAN                           | I_USER2            |     1 |    20 |       |     1   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |* 41 |          INDEX RANGE SCAN                          | I_OBJ4             |     1 |    12 |       |     2   (0)| 00:00:01 |
    |  42 |        NESTED LOOPS                                |                    |     1 |    32 |       |     3   (0)| 00:00:01 |
    |* 43 |         INDEX SKIP SCAN                            | I_USER2            |     1 |    20 |       |     1   (0)| 00:00:01 |
    |* 44 |         INDEX RANGE SCAN                           | I_OBJ4             |     1 |    12 |       |     2   (0)| 00:00:01 |
    |* 45 |       FILTER                                       |                    |       |       |       |            |          |
    |  46 |        NESTED LOOPS                                |                    |     1 |   129 |       |  1065   (1)| 00:00:13 |
    |  47 |         NESTED LOOPS                               |                    |     1 |   107 |       |  1064   (1)| 00:00:13 |
    |  48 |          NESTED LOOPS                              |                    |     1 |    69 |       |  1061   (1)| 00:00:13 |
    |  49 |           NESTED LOOPS                             |                    |     2 |    66 |       |  1059   (1)| 00:00:13 |
    |  50 |            TABLE ACCESS BY INDEX ROWID             | USER$              |     1 |    20 |       |     1   (0)| 00:00:01 |
    |* 51 |             INDEX UNIQUE SCAN                      | I_USER1            |     1 |       |       |     0   (0)|          |
    PLAN_TABLE_OUTPUT
    |  52 |            VIEW                                    | _ALL_SYNONYMS_TREE |     2 |    26 |       |  1058   (1)| 00:00:13 |
    |* 53 |             CONNECT BY NO FILTERING WITH START-WITH|                    |       |       |       |            |          |
    |* 54 |              FILTER                                |                    |       |       |       |            |          |
    |* 55 |               HASH JOIN                            |                    |   705 | 81780 |       |  1058   (1)| 00:00:13 |
    |  56 |                INDEX FULL SCAN                     | I_USER2            |   124 |  2728 |       |     1   (0)| 00:00:01 |
    |* 57 |                HASH JOIN                           |                    |   705 | 66270 |       |  1057   (1)| 00:00:13 |
    |  58 |                 TABLE ACCESS FULL                  | USER$              |   124 |  2480 |       |     4   (0)| 00:00:01 |
    |* 59 |                 HASH JOIN                          |                    | 66964 |  4839K|  2232K|  1052   (1)| 00:00:13 |
    |  60 |                  TABLE ACCESS FULL                 | SYN$               | 47615 |  1673K|       |    78   (2)| 00:00:01 |
    |* 61 |                  INDEX FAST FULL SCAN              | I_OBJ5             | 47862 |  1776K|       |   752   (1)| 00:00:10 |
    |  62 |               NESTED LOOPS                         |                    |     1 |    32 |       |     3   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |* 63 |                INDEX SKIP SCAN                     | I_USER2            |     1 |    20 |       |     1   (0)| 00:00:01 |
    |* 64 |                INDEX RANGE SCAN                    | I_OBJ4             |     1 |    12 |       |     2   (0)| 00:00:01 |
    |* 65 |              FILTER                                |                    |       |       |       |            |          |
    |  66 |               TABLE ACCESS BY INDEX ROWID          | SYN$               |     1 |    36 |       |     2   (0)| 00:00:01 |
    |* 67 |                INDEX UNIQUE SCAN                   | I_SYN1             |     1 |       |       |     1   (0)| 00:00:01 |
    |* 68 |               FILTER                               |                    |       |       |       |            |          |
    |* 69 |                FILTER                              |                    |       |       |       |            |          |
    |  70 |                 NESTED LOOPS                       |                    |     3 |   279 |       |     5   (0)| 00:00:01 |
    |  71 |                  NESTED LOOPS                      |                    |     1 |    80 |       |     4   (0)| 00:00:01 |
    |  72 |                   NESTED LOOPS                     |                    |     1 |    58 |       |     3   (0)| 00:00:01 |
    |  73 |                    TABLE ACCESS BY INDEX ROWID     | USER$              |     1 |    20 |       |     1   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |* 74 |                     INDEX UNIQUE SCAN              | I_USER1            |     1 |       |       |     0   (0)|          |
    |* 75 |                    INDEX RANGE SCAN                | I_OBJ5             |     1 |    38 |       |     2   (0)| 00:00:01 |
    |* 76 |                   INDEX RANGE SCAN                 | I_USER2            |     1 |    22 |       |     1   (0)| 00:00:01 |
    |* 77 |                  INDEX RANGE SCAN                  | I_OBJAUTH1         |     3 |    39 |       |     1   (0)| 00:00:01 |
    |* 78 |                FIXED TABLE FULL                    | X$KZSRO            |     1 |     3 |       |     0   (0)|          |
    |  79 |                NESTED LOOPS                        |                    |     1 |    32 |       |     3   (0)| 00:00:01 |
    |* 80 |                 INDEX SKIP SCAN                    | I_USER2            |     1 |    20 |       |     1   (0)| 00:00:01 |
    |* 81 |                 INDEX RANGE SCAN                   | I_OBJ4             |     1 |    12 |       |     2   (0)| 00:00:01 |
    |* 82 |               FIXED TABLE FULL                     | X$KZSPR            |    17 |   119 |       |     0   (0)|          |
    |* 83 |           TABLE ACCESS BY INDEX ROWID              | SYN$               |     1 |    36 |       |     1   (0)| 00:00:01 |
    |* 84 |            INDEX UNIQUE SCAN                       | I_SYN1             |     1 |       |       |     0   (0)|          |
    PLAN_TABLE_OUTPUT
    |* 85 |          TABLE ACCESS BY INDEX ROWID               | OBJ$               |     1 |    38 |       |     3   (0)| 00:00:01 |
    |* 86 |           INDEX RANGE SCAN                         | I_OBJ1             |     1 |       |       |     2   (0)| 00:00:01 |
    |* 87 |         INDEX RANGE SCAN                           | I_USER2            |     1 |    22 |       |     1   (0)| 00:00:01 |
    |  88 |        NESTED LOOPS                                |                    |     1 |    32 |       |     3   (0)| 00:00:01 |
    |* 89 |         INDEX SKIP SCAN                            | I_USER2            |     1 |    20 |       |     1   (0)| 00:00:01 |
    |* 90 |         INDEX RANGE SCAN                           | I_OBJ4             |     1 |    12 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - filter((:B2='TYPE' OR :B2='TABLE' OR :B2='VIEW' OR :B2='FUNCTION' OR :B2='PROCEDURE' OR :B2='PACKAGE' OR
                  :B2='SEQUENCE' OR :B2='QUEUE' OR :B2='SYNONYM'))
       6 - filter("U"."TYPE#"=1)
       7 - filter("CDU"."USER_TYPE"='S')
       8 - access("CDU"."USER_NAME"="U"."NAME")
      10 - access("U"."DATATS#"="DTS"."TS#")
      12 - access("U"."TEMPTS#"="TTS"."TS#")
      16 - filter(((INTERNAL_FUNCTION("O"."SPARE3") OR ("S"."NODE" IS NULL AND  IS NOT NULL) OR  IS NOT NULL) AND
                  (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND
                  "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND
                  "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR (SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND
    PLAN_TABLE_OUTPUT
                  "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR  IS NOT
                  NULL)))
      21 - access("U"."NAME"="CDU"."USER_NAME")
      23 - access("S"."NAME"=:B1)
           filter("S"."NAME"=:B1)
      24 - filter("O"."SPARE3"="U"."USER#")
      25 - access("O"."OBJ#"="S"."OBJ#" AND "O"."TYPE#"=5)
           filter("O"."TYPE#"=5)
      26 - access("O"."OWNER#"="U"."USER#")
      27 - filter((((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR
                  (-"KZSPRPRV")=(-50)) AND "INST_ID"=USERENV('INSTANCE')))
    PLAN_TABLE_OUTPUT
      28 - filter((("BA"."GRANTOR#"=USERENV('SCHEMAID') OR  IS NOT NULL) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND
                  "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
                  "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR
                  BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND
                  ((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
                  "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR  IS NOT NULL)))))
      29 - filter(:B1 IS NULL)
      34 - access("BU"."NAME"=:B1)
      35 - access("BU"."USER#"="O"."SPARE3" AND "O"."NAME"=:B1)
      36 - access("O"."OWNER#"="U"."USER#")
      37 - access("BA"."OBJ#"="O"."OBJ#")
    PLAN_TABLE_OUTPUT
      38 - filter("KZSROROL"=:B1)
      40 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
           filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
      41 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
      43 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
           filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
      44 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
      45 - filter((("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND
                  "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND
                  "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR
                  (SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
    PLAN_TABLE_OUTPUT
                  "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR  IS NOT NULL))
      51 - access("U"."NAME"="CDU"."USER_NAME")
      53 - access("S"."BASE_SYN_ID"=PRIOR NULL)
           filter( IS NOT NULL)
      54 - filter((("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND
                  "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND
                  "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR BITAND("U"."SPARE1",16)=0 OR
                  (SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
                  "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR  IS NOT NULL))
      55 - access("O"."OWNER#"="U"."USER#")
      57 - access("S"."OWNER"="BU"."NAME" AND "BU"."USER#"="O"."SPARE3")
    PLAN_TABLE_OUTPUT
      59 - access("S"."NAME"="O"."NAME")
      61 - filter("O"."TYPE#"=5)
      63 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
           filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
      64 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
      65 - filter(( IS NOT NULL OR ("S"."NODE" IS NULL AND  IS NOT NULL)))
      67 - access("S"."OBJ#"=:B1)
      68 - filter((("BA"."GRANTOR#"=USERENV('SCHEMAID') OR  IS NOT NULL) AND (("O"."TYPE#"<>4 AND "O"."TYPE#"<>5 AND
                  "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>10 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
                  "O"."TYPE#"<>13 AND "O"."TYPE#"<>14 AND "O"."TYPE#"<>22 AND "O"."TYPE#"<>87 AND "O"."TYPE#"<>88) OR
                  BITAND("U"."SPARE1",16)=0 OR (INTERNAL_FUNCTION("O"."TYPE#") AND
    PLAN_TABLE_OUTPUT
                  ((SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE' AND "U"."TYPE#"<>2) OR ("U"."TYPE#"=2 AND
                  "U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))) OR  IS NOT NULL)))))
      69 - filter(:B1 IS NULL)
      74 - access("BU"."NAME"=:B1)
      75 - access("BU"."USER#"="O"."SPARE3" AND "O"."NAME"=:B1)
      76 - access("O"."OWNER#"="U"."USER#")
      77 - access("BA"."OBJ#"="O"."OBJ#")
      78 - filter("KZSROROL"=:B1)
      80 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
           filter(("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))
      81 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TY

  • USER I/O Wait (Please help kind of stuck here from long time)

    I have a delete statement running from more than 24 hrs now and the session info says its waiting on user I/O. There are no blocking sessions and its doing a full table scan of a table having around 500000 records. I dont understand what exactly its waiting on and how to check that and why it taking more than 24 hrs to FTS of 1 table? Here are some of the statistics:
    SQL> select blocking_session, event, wait_class, wait_time, seconds_in_wait, state from v$session where sid=1026;
    BLOCKING_SESSION EVENT WAIT_CLASS WAIT_TIME SECONDS_IN_WAIT
    STATE
    db file scattered read User I/O 0 0
    WAITING
    SQL> select * from table(dbms_xplan.display_cursor('1g5k0k3qpy8j2'));
    PLAN_TABLE_OUTPUT
    SQL_ID 1g5k0k3qpy8j2, child number 0
    DELETE FROM RX_TX WHERE ID IN (SELECT ID FROM TEMP_PURGE WHERE TABLE_NAME = 'rx_
    tx')
    Plan hash value: 3126475949
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)
    | Time |
    | 0 | DELETE STATEMENT | | | | | 17239 (100)
    | |
    | 1 | DELETE | RX_TX | | | |
    | |
    PLAN_TABLE_OUTPUT
    |* 2 | HASH JOIN RIGHT SEMI| | 513K| 123M| 14M| 17239 (2)
    | 00:03:27 |
    |* 3 | TABLE ACCESS FULL | TEMP_PURGE | 557K| 8717K| | 2789 (2)
    | 00:00:34 |
    | 4 | TABLE ACCESS FULL | RX_TX | 578K| 130M| | 6918 (2)
    | 00:01:24 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
    2 - access("ID"="ID")
    3 - filter("TABLE_NAME"='rx_tx')
    22 rows selected.
    SQL> select b.name, a.value from v$sesstat a, v$statname b
    where a.statistic# = b.statistic#
    and a.value > 0 2 3
    4 and b.name like '%wait%'
    5 and a.sid=1026;
    NAME VALUE
    concurrency wait time 1615
    application wait time 388
    user I/O wait time 13403000
    enqueue waits 1
    shared hash latch upgrades - no wait 7924935
    redo log space wait time 2852
    6 rows selected.
    Any help would be appreciable.
    This deletes more that 60% of the records from this table so indexed should be out of question here, i think.
    Daljit Singh
    Message was edited by:
    Daljit

    Thanks for replying Reega, here is the required
    info:
    SQL> select p1text, p1, p2text, p2, p3text, p3 from
    v$session where sid=1026;
    P1TEXT
    1
    P2TEXT
    2
    P3TEXT
    3
    file#
    block#
    16937
    blocks
    6
    Actually Reega had a good point, not sure why he didn't go down the route.
    You may want to find out what's that table/index your session is waiting from the value, something like
    select   owner||'.'||segment_name,  segment_type
    from dba_extents
    where file_id=4 and (block_id between 116937 and 116937+66)This might be a long run query if you have many objects.
    Actually the better view to query is v$session_wait instead of v$session.
    Check article you might find useful,
    Oracle wait tuning with v$session_wait

  • COLLECTION ITERATOR PICKLER FETCH along with XMLSEQUENCEFROMXMLTYPE

    Hi All,
    We have Oracle database 10.2.0.4 on solaris 10.
    I found some xml queries which are consuming CPU and memory highly, below is the execution plan for one of this xml sql.
    PLAN_TABLE_OUTPUT
    SQL_ID  gzsfqp1mkfk8t, child number 0
    SELECT B.PACKET_ID FROM CM_PACKET_ALT_KEY B, CM_ALT_KEY_TYPE C, TABLE (XMLSEQUENCE (EXTRACT (:B1 ,
    '/AlternateKeys/AlternateKey'))) T WHERE B.ALT_KEY_TYPE_ID = C.ALT_KEY_TYPE_ID AND C.ALT_KEY_TYPE_NAME = EXTRACTVALUE
    (VALUE (T), '/AlternateKey/@keyType') AND B.ALT_KEY_VALUE = EXTRACTVALUE (VALUE (T), '/AlternateKey') AND NVL
    (B.CHILD_BROKER_CODE, '6209870F57C254D6E04400306E4A78B0') = NVL (EXTRACTVALUE (VALUE (T), '/AlternateKey/@broker'),
    '6209870F57C254D6E04400306E4A78B0')
    Plan hash value: 855909818
    PLAN_TABLE_OUTPUT
    | Id  | Operation                           | Name                   | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT                    |                        |       |       | 16864 (100)|          |       |       |
    |*  1 |  HASH JOIN                          |                        |    45 |  3240 | 16864   (2)| 00:03:23 |       |       |
    |   2 |   TABLE ACCESS FULL                 | CM_ALT_KEY_TYPE        |     5 |   130 |     6   (0)| 00:00:01 |       |       |
    |*  3 |   HASH JOIN                         |                        |   227 | 10442 | 16858   (2)| 00:03:23 |       |       |
    |   4 |    COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE |       |       |            |          |       |       |
    |   5 |    PARTITION HASH ALL               |                        |    10M|   447M| 16758   (2)| 00:03:22 |     1 |    16 |
    |   6 |     TABLE ACCESS FULL               | CM_PACKET_ALT_KEY      |    10M|   447M| 16758   (2)| 00:03:22 |     1 |    16 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       1 - access("B"."ALT_KEY_TYPE_ID"="C"."ALT_KEY_TYPE_ID" AND
                  "C"."ALT_KEY_TYPE_NAME"=SYS_OP_C2C(EXTRACTVALUE(VALUE(KOKBF$),'/AlternateKey/@keyType')))
       3 - access("B"."ALT_KEY_VALUE"=EXTRACTVALUE(VALUE(KOKBF$),'/AlternateKey') AND
                  NVL("B"."CHILD_BROKER_CODE",'6209870F57C254D6E04400306E4A78B0')=NVL(EXTRACTVALUE(VALUE(KOKBF$),'/AlternateKey/@broker'
                  ),'6209870F57C254D6E04400306E4A78B0'))Seems due to
    1.COLLECTION ITERATOR PICKLER FETCH along with XMLSEQUENCEFROMXMLTYPE which i think is due to usage of table( XMLSEQUENCE() )
    2.Conversion taking place according to SYS_OP_C2C function as shown in Predicate Information.
    3.Table is not using xmltype datatype to store XML
    4.Wilcards have been used (/AlternateKey/@keyType)
    Could anyone please help me in tuning this query as i know very less about XML DB
    Including one more sql which also use to consume huge CPU and memory, these tables are also not hving any column with xmltype datatype.
    SELECT /*+  INDEX(e) */ XMLAGG(XMLELEMENT ( "TaggingCategory", XMLATTRIBUTES (G.TAG_CATEGORY_CODE AS
    "categoryType"), XMLELEMENT ("TaggingValue", XMLATTRIBUTES (C.IS_PRIMARY AS "primary", H.ORIGIN_CODE AS
    "origin"), XMLAGG (XMLCONCAT (XMLELEMENT ("Value", XMLATTRIBUTES (F.TAG_LIST_CODE AS "listType"),
    E.TAG_VALUE), CASE WHEN LEVEL = 1 THEN :B4 ELSE NULL END))) )) FROM TABLE (CAST (:B1 AS
    T_TAG_MAP_HIERARCHY_TAB)) A, TABLE (CAST (:B2 AS T_ENUM_TAG_TAB)) C, REM_TAG_VALUE E, REM_TAG_LIST F,
    REM_TAG_CATEGORY G, CM_ORIGIN H WHERE E.TAG_VALUE_ID = C.TAG_VALUE_ID AND F.TAG_LIST_ID = E.TAG_LIST_ID
    AND G.TAGGING_CATEGORY_ID = F.TAGGING_CATEGORY_ID AND H.ORIGIN_ID = C.ORIGIN_ID AND C.ENUM_TAG_ID =
    A.MAPPED_ENUM_TAG_ID GROUP BY G.TAG_CATEGORY_CODE, C.IS_PRIMARY, H.ORIGIN_CODE START WITH
    A.MAPPED_ENUM_TAG_ID = HEXTORAW (:B3 ) CONNECT BY PRIOR A.MAPPED_ENUM_TAG_ID = A.ENUM_TAG_ID
    Plan hash value: 2393257319
    | Id  | Operation                                    | Name             | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                             |                  |       |       | 16455 (100)|          |
    |   1 |  SORT AGGREGATE                              |                  |     1 |   185 | 16455   (1)| 00:03:18 |
    |   2 |   SORT GROUP BY                              |                  |     1 |   185 | 16455   (1)| 00:03:18 |
    |*  3 |    CONNECT BY WITH FILTERING                 |                  |       |       |            |          |
    |*  4 |     FILTER                                   |                  |       |       |            |          |
    |   5 |      COUNT                                   |                  |       |       |            |          |
    |*  6 |       HASH JOIN                              |                  |   667K|   117M| 16413   (1)| 00:03:17 |
    |   7 |        COLLECTION ITERATOR PICKLER FETCH     |                  |       |       |            |          |
    |*  8 |        HASH JOIN                             |                  |  8168 |  1459K| 16384   (1)| 00:03:17 |
    |   9 |         TABLE ACCESS FULL                    | REM_TAG_CATEGORY |    25 |   950 |     5   (0)| 00:00:01 |
    |* 10 |         HASH JOIN                            |                  |  8168 |  1156K| 16378   (1)| 00:03:17 |
    |  11 |          TABLE ACCESS FULL                   | REM_TAG_LIST     |   117 |  7137 |     5   (0)| 00:00:01 |
    |  12 |          NESTED LOOPS                        |                  |  8168 |   670K| 16373   (1)| 00:03:17 |
    |  13 |           MERGE JOIN                         |                  |  8168 |   215K|    27   (4)| 00:00:01 |
    |  14 |            TABLE ACCESS BY INDEX ROWID       | CM_ORIGIN        |     2 |    50 |     2   (0)| 00:00:01 |
    |  15 |             INDEX FULL SCAN                  | PK_CM_ORIGIN     |     2 |       |     1   (0)| 00:00:01 |
    |* 16 |            SORT JOIN                         |                  |  8168 | 16336 |    25   (4)| 00:00:01 |
    |  17 |             COLLECTION ITERATOR PICKLER FETCH|                  |       |       |            |          |
    |  18 |           TABLE ACCESS BY INDEX ROWID        | REM_TAG_VALUE    |     1 |    57 |     2   (0)| 00:00:01 |
    |* 19 |            INDEX UNIQUE SCAN                 | PK_REM_TAG_VALUE |     1 |       |     1   (0)| 00:00:01 |
    |* 20 |     HASH JOIN                                |                  |       |       |            |          |
    |  21 |      CONNECT BY PUMP                         |                  |       |       |            |          |
    |  22 |      COUNT                                   |                  |       |       |            |          |
    |* 23 |       HASH JOIN                              |                  |   667K|   117M| 16413   (1)| 00:03:17 |
    |  24 |        COLLECTION ITERATOR PICKLER FETCH     |                  |       |       |            |          |
    |* 25 |        HASH JOIN                             |                  |  8168 |  1459K| 16384   (1)| 00:03:17 |
    |  26 |         TABLE ACCESS FULL                    | REM_TAG_CATEGORY |    25 |   950 |     5   (0)| 00:00:01 |
    |* 27 |         HASH JOIN                            |                  |  8168 |  1156K| 16378   (1)| 00:03:17 |
    |  28 |          TABLE ACCESS FULL                   | REM_TAG_LIST     |   117 |  7137 |     5   (0)| 00:00:01 |
    |  29 |          NESTED LOOPS                        |                  |  8168 |   670K| 16373   (1)| 00:03:17 |
    |  30 |           MERGE JOIN                         |                  |  8168 |   215K|    27   (4)| 00:00:01 |
    |  31 |            TABLE ACCESS BY INDEX ROWID       | CM_ORIGIN        |     2 |    50 |     2   (0)| 00:00:01 |
    |  32 |             INDEX FULL SCAN                  | PK_CM_ORIGIN     |     2 |       |     1   (0)| 00:00:01 |
    |* 33 |            SORT JOIN                         |                  |  8168 | 16336 |    25   (4)| 00:00:01 |
    |  34 |             COLLECTION ITERATOR PICKLER FETCH|                  |       |       |            |          |
    |  35 |           TABLE ACCESS BY INDEX ROWID        | REM_TAG_VALUE    |     1 |    57 |     2   (0)| 00:00:01 |
    |* 36 |            INDEX UNIQUE SCAN                 | PK_REM_TAG_VALUE |     1 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - access(SYS_OP_ATG(VALUE(KOKBF$),1,2,2)=PRIOR NULL)
       4 - filter(SYS_OP_ATG(VALUE(KOKBF$),2,3,2)=HEXTORAW(:B3))
       6 - access(SYS_OP_ATG(VALUE(KOKBF$),1,2,2)=SYS_OP_ATG(VALUE(KOKBF$),2,3,2))
       8 - access("G"."TAGGING_CATEGORY_ID"="F"."TAGGING_CATEGORY_ID")
      10 - access("F"."TAG_LIST_ID"="E"."TAG_LIST_ID")
      16 - access("H"."ORIGIN_ID"=SYS_OP_ATG(VALUE(KOKBF$),3,4,2))
           filter("H"."ORIGIN_ID"=SYS_OP_ATG(VALUE(KOKBF$),3,4,2))
      19 - access("E"."TAG_VALUE_ID"=SYS_OP_ATG(VALUE(KOKBF$),7,8,2))
      20 - access(SYS_OP_ATG(VALUE(KOKBF$),1,2,2)=PRIOR NULL)
      23 - access(SYS_OP_ATG(VALUE(KOKBF$),1,2,2)=SYS_OP_ATG(VALUE(KOKBF$),2,3,2))
      25 - access("G"."TAGGING_CATEGORY_ID"="F"."TAGGING_CATEGORY_ID")
      27 - access("F"."TAG_LIST_ID"="E"."TAG_LIST_ID")
      33 - access("H"."ORIGIN_ID"=SYS_OP_ATG(VALUE(KOKBF$),3,4,2))
           filter("H"."ORIGIN_ID"=SYS_OP_ATG(VALUE(KOKBF$),3,4,2))
      36 - access("E"."TAG_VALUE_ID"=SYS_OP_ATG(VALUE(KOKBF$),7,8,2))-Yasser
    Edited by: YasserRACDBA on Feb 24, 2010 8:30 PM
    Added one more sql..

    Looking at the second query, it too has a lot of bind variables... Can you find out the types and values of each BIND. Also, I'm suspcious about the use of XMLCONCAT.. Can you found out why the developer is using it..
    SELECT /*+  INDEX(e) */  XMLAGG
                                XMLELEMENT
                                   "TaggingCategory",
                                   XMLATTRIBUTES (G.TAG_CATEGORY_CODE AS "categoryType"),
                                   XMLELEMENT
                                     "TaggingValue",
                                     XMLATTRIBUTES (C.IS_PRIMARY AS "primary", H.ORIGIN_CODE AS "origin"),
                                     XMLAGG
                                        XMLCONCAT
                                          XMLELEMENT
                                            "Value",
                                            XMLATTRIBUTES (F.TAG_LIST_CODE AS "listType"),
                                            E.TAG_VALUE
                                          CASE WHEN LEVEL = 1
                                              THEN :B4
                                              ELSE NULL
                                          END
    FROM TABLE (CAST (:B1 AS T_TAG_MAP_HIERARCHY_TAB)) A,
          TABLE (CAST (:B2 AS T_ENUM_TAG_TAB)) C,
          REM_TAG_VALUE E,
          REM_TAG_LIST F,
          REM_TAG_CATEGORY G,
          CM_ORIGIN H
    WHERE E.TAG_VALUE_ID = C.TAG_VALUE_ID
      AND F.TAG_LIST_ID = E.TAG_LIST_ID
      AND G.TAGGING_CATEGORY_ID = F.TAGGING_CATEGORY_ID
      AND H.ORIGIN_ID = C.ORIGIN_ID
      AND C.ENUM_TAG_ID = A.MAPPED_ENUM_TAG_ID
    GROUP BY G.TAG_CATEGORY_CODE, C.IS_PRIMARY, H.ORIGIN_CODE
          START WITH A.MAPPED_ENUM_TAG_ID = HEXTORAW (:B3 )
          CONNECT BY PRIOR A.MAPPED_ENUM_TAG_ID = A.ENUM_TAG_IDEdited by: mdrake on Feb 24, 2010 8:11 AM

  • Hash group by improvement

    I see that one of my queries from an application time is spending most of its time in the hash group by. I'm running Oracle 11g with a quarter rack exadata appliance. Is there a better way to run or design this table?
    query:
    SELECT COUNT(*)
    FROM (
            SELECT "DDTMDAY", "MRKTNM", "BSMNM", "BSCNM", "CLNM", "CSCDNM", "BTSID", "SECTSEQID", "BNDID", "FAID", SUM("VATTCNT"), SUM("VMBLORGCNT"), SUM("VMBLTERCNT"), SUM("VSILENTRETRYCNT"), SUM("VCUSTBLKCNT"), SUM("VAXSFCNT"), SUM("VCEBLKCNT"), SUM("VWCDBLKCNT"), SUM("VT1BHLBLKCNT"), SUM("VPWRBLKCNT"), SUM("VNONBTSEQBLKCNT"), SUM("VSFULCALLCNT"), SUM("VDRPCALLCNT"), SUM("DATTCNT"), SUM("DMBLORGCNT"), SUM("DMBLTERCNT"), SUM("DSILENTRETRYCNT"), SUM("DCUSTBLKCNT"), SUM("DAXSFCNT"), SUM("DCEBLKCNT"), SUM("DWCDBLKCNT"), SUM("DT1BHLBLKCNT"), SUM("DPWRBLKCNT"), SUM("DNONBTSEQBLKCNT"), SUM("DSFULCALLCNT"), SUM("DDRPCALLCNT"), SUM("VPRIMCALLERL"), SUM("VMOUTMS"), SUM("DPRIMCALLERL"), SUM("SMSATTCNT"), SUM("SMSSXSCNT"), SUM("VHHIATTCNT"), SUM("VHHIBADFRMCNT"), SUM("VHHICALLSETUPSXSCNT"), SUM("DHHIATTCNT"), SUM("DHHIBADFRMCNT"), SUM("DHHICALLSETUPSXSCNT") FROM (SELECT
       trunc(D1."D_DTM", 'dd') AS "DDTMDAY",
       D2."MRKT_NM" AS "MRKTNM",
       D3."BSC_NM" AS "BSMNM",
       D3."BSC_NM" AS "BSCNM",
       D2."CLUSTER_NM" AS "CLNM",
       D1."CSCD_NM" AS "CSCDNM",
       D1."BTS_ID" AS "BTSID",
       D1."SECT_SEQ_ID" AS "SECTSEQID",
       D1."BND_ID" AS "BNDID",
       D1."FA_ID" AS "FAID",
       D1."V_ATT_CNT" AS "VATTCNT",
       D1."V_MBL_ORG_CNT" AS "VMBLORGCNT",
       D1."V_MBL_TER_CNT" AS "VMBLTERCNT",
       D1."V_SILENT_RETRY_CNT" AS "VSILENTRETRYCNT",
       D1."V_CUST_BLK_CNT" AS "VCUSTBLKCNT",
       D1."V_AXS_F_CNT" AS "VAXSFCNT",
       D1."V_CE_BLK_CNT" AS "VCEBLKCNT",
       D1."V_WCD_BLK_CNT" AS "VWCDBLKCNT",
       D1."V_T1_BHL_BLK_CNT" AS "VT1BHLBLKCNT",
       D1."V_PWR_BLK_CNT" AS "VPWRBLKCNT",
       D1."V_NON_BTS_EQ_BLK_CNT" AS "VNONBTSEQBLKCNT",
       D1."V_SFUL_CALL_CNT" AS "VSFULCALLCNT",
       D1."V_DRP_CALL_CNT" AS "VDRPCALLCNT",
       D1."D_ATT_CNT" AS "DATTCNT",
       D1."D_MBL_ORG_CNT" AS "DMBLORGCNT",
       D1."D_MBL_TER_CNT" AS "DMBLTERCNT",
       D1."D_SILENT_RETRY_CNT" AS "DSILENTRETRYCNT",
       D1."D_CUST_BLK_CNT" AS "DCUSTBLKCNT",
       D1."D_AXS_F_CNT" AS "DAXSFCNT",
       D1."D_CE_BLK_CNT" AS "DCEBLKCNT",
       D1."D_WCD_BLK_CNT" AS "DWCDBLKCNT",
       D1."D_T1_BHL_BLK_CNT" AS "DT1BHLBLKCNT",
       D1."D_PWR_BLK_CNT" AS "DPWRBLKCNT",
       D1."D_NON_BTS_EQ_BLK_CNT" AS "DNONBTSEQBLKCNT",
       D1."D_SFUL_CALL_CNT" AS "DSFULCALLCNT",
       D1."D_DRP_CALL_CNT" AS "DDRPCALLCNT",
       D1."V_PRIM_CALL_ERL" AS "VPRIMCALLERL",
       D1."V_MOU_TMS" AS "VMOUTMS",
       D1."D_PRIM_CALL_ERL" AS "DPRIMCALLERL",
       D1."SMS_ATT_CNT" AS "SMSATTCNT",
       D1."SMS_SXS_CNT" AS "SMSSXSCNT",
       D1."V_HHI_ATT_CNT" AS "VHHIATTCNT",
       D1."V_HHI_BAD_FRM_CNT" AS "VHHIBADFRMCNT",
       D1."V_HHI_CALL_SETUP_SXS_CNT" AS "VHHICALLSETUPSXSCNT",
       D1."D_HHI_ATT_CNT" AS "DHHIATTCNT",
       D1."D_HHI_BAD_FRM_CNT" AS "DHHIBADFRMCNT",
       D1."D_HHI_CALL_SETUP_SXS_CNT" AS "DHHICALLSETUPSXSCNT"
    FROM
       "DMSN"."DS3R_FH_1XRTT_FA_LVL_KPI_TEMP" D1
    LEFT OUTER JOIN "DMSN"."SITES_GEO_HIERARCHY" D2
    ON
    D1."BTS_ID" = D2."BTS_ID"
    AND
    D1."CSCD_NM" = D2."CSCD_NM"
    LEFT OUTER JOIN "DMSN"."SITES_SYS_HIERARCHY" D3
    ON
    D1."BTS_ID" = D3."BTS_ID"
    AND
    D1."CSCD_NM" = D3."CSCD_NM"
    WHERE
    trunc(D1."D_DTM", 'dd') >= SYSDATE - 40 and  trunc(D1."D_DTM", 'dd') < SYSDATE - 1
    ) T GROUP BY "DDTMDAY", "MRKTNM", "BSMNM", "BSCNM", "CLNM", "CSCDNM", "BTSID", "SECTSEQID", "BNDID", "FAID" ORDER BY "DDTMDAY", "MRKTNM", "BSMNM", "BSCNM", "CLNM", "CSCDNM", "BTSID", "SECTSEQID", "BNDID", "FAID"      
    Explain plan
    SQL> alter session set statistics_level = all
      2
    SQL> @C:\TEST.SQL
      COUNT(*)
       1101270
    SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR);
    PLAN_TABLE_OUTPUT
    SQL_ID  gqj9q831g6s78, child number 0
    SELECT COUNT(*) FROM (         SELECT "DDTMDAY", "MRKTNM", "BSMNM",
    "BSCNM", "CLNM", "CSCDNM", "BTSID", "SECTSEQID", "BNDID", "FAID",
    SUM("VATTCNT"), SUM("VMBLORGCNT"), SUM("VMBLTERCNT"),
    SUM("VSILENTRETRYCNT"), SUM("VCUSTBLKCNT"), SUM("VAXSFCNT"),
    SUM("VCEBLKCNT"), SUM("VWCDBLKCNT"), SUM("VT1BHLBLKCNT"),
    SUM("VPWRBLKCNT"), SUM("VNONBTSEQBLKCNT"), SUM("VSFULCALLCNT"),
    SUM("VDRPCALLCNT"), SUM("DATTCNT"), SUM("DMBLORGCNT"),
    SUM("DMBLTERCNT"), SUM("DSILENTRETRYCNT"), SUM("DCUSTBLKCNT"),
    SUM("DAXSFCNT"), SUM("DCEBLKCNT"), SUM("DWCDBLKCNT"),
    PLAN_TABLE_OUTPUT
    SUM("DT1BHLBLKCNT"), SUM("DPWRBLKCNT"), SUM("DNONBTSEQBLKCNT"),
    SUM("DSFULCALLCNT"), SUM("DDRPCALLCNT"), SUM("VPRIMCALLERL"),
    SUM("VMOUTMS"), SUM("DPRIMCALLERL"), SUM("SMSATTCNT"),
    SUM("SMSSXSCNT"), SUM("VHHIATTCNT"), SUM("VHHIBADFRMCNT"),
    SUM("VHHICALLSETUPSXSCNT"), SUM("DHHIATTCNT"), SUM("DHHIBADFRMCNT"),
    SUM("DHHICALLSETUPSXSCNT") FROM (SELECT    trunc(D1."D_DTM", 'dd') AS
    "DDTMDAY",    D2."MRKT_NM" AS "MRKTNM",    D3."BSC_NM" AS "BSMNM",
    D3."BSC_
    Plan hash value: 1618890056
    PLAN_TABLE_OUTPUT
    | Id  | Operation                               | Name
    | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Pstart| Pstop |    TQ  |IN-OUT
    | PQ Distrib |
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT                        |
    |       |       |       |   139K(100)|          |       |       |        |
    |            |
    |   1 |  SORT AGGREGATE                         |
    |     1 |       |       |            |          |       |       |        |
    |            |
    |*  2 |   PX COORDINATOR                        |
    |       |       |       |            |          |       |       |        |
    PLAN_TABLE_OUTPUT
    |            |
    |   3 |    PX SEND QC (RANDOM)                  | :TQ10003
    |     1 |       |       |            |          |       |       |  Q1,03 | P->S
    | QC (RAND)  |
    |   4 |     SORT AGGREGATE                      |
    |     1 |       |       |            |          |       |       |  Q1,03 | PCWP
    |            |
    |   5 |      VIEW                               |
    PLAN_TABLE_OUTPUT
    |    44M|       |       |   139K  (1)| 00:27:51 |       |       |  Q1,03 | PCWP
    |            |
    |   6 |       HASH GROUP BY                     |
    |    44M|    10G|    11G|   139K  (1)| 00:27:51 |       |       |  Q1,03 | PCWP
    |            |
    |   7 |        PX RECEIVE                       |
    |    44M|    10G|       | 34102   (1)| 00:06:50 |       |       |  Q1,03 | PCWP
    |            |
    PLAN_TABLE_OUTPUT
    |   8 |         PX SEND HASH                    | :TQ10002
    |    44M|    10G|       | 34102   (1)| 00:06:50 |       |       |  Q1,02 | P->P
    | HASH       |
    |*  9 |          FILTER                         |
    |       |       |       |            |          |       |       |  Q1,02 | PCWC
    |            |
    |* 10 |           HASH JOIN RIGHT OUTER         |
    |    44M|    10G|       | 34102   (1)| 00:06:50 |       |       |  Q1,02 | PCWP
    |            |
    PLAN_TABLE_OUTPUT
    |  11 |            BUFFER SORT                  |
    |       |       |       |            |          |       |       |  Q1,02 | PCWC
    |            |
    |  12 |             PX RECEIVE                  |
    | 13410 |   261K|       |    15   (0)| 00:00:01 |       |       |  Q1,02 | PCWP
    |            |
    |  13 |              PX SEND BROADCAST          | :TQ10000
    | 13410 |   261K|       |    15   (0)| 00:00:01 |       |       |        | S->P
    PLAN_TABLE_OUTPUT
    | BROADCAST  |
    |  14 |               TABLE ACCESS STORAGE FULL | SITES_SYS_HIERARCHY
    | 13410 |   261K|       |    15   (0)| 00:00:01 |       |       |        |
    |            |
    |* 15 |            HASH JOIN RIGHT OUTER        |
    |    44M|    10G|       | 34082   (1)| 00:06:49 |       |       |  Q1,02 | PCWP
    |            |
    |  16 |             BUFFER SORT                 |
    PLAN_TABLE_OUTPUT
    |       |       |       |            |          |       |       |  Q1,02 | PCWC
    |            |
    |  17 |              PX RECEIVE                 |
    | 13410 |   667K|       |    34   (0)| 00:00:01 |       |       |  Q1,02 | PCWP
    |            |
    |  18 |               PX SEND BROADCAST         | :TQ10001
    | 13410 |   667K|       |    34   (0)| 00:00:01 |       |       |        | S->P
    | BROADCAST  |
    PLAN_TABLE_OUTPUT
    |  19 |                TABLE ACCESS STORAGE FULL| SITES_GEO_HIERARCHY
    | 13410 |   667K|       |    34   (0)| 00:00:01 |       |       |        |
    |            |
    |  20 |             PX BLOCK ITERATOR           |
    |    44M|  8193M|       | 34042   (1)| 00:06:49 |     1 |1048575|  Q1,02 | PCWC
    |            |
    |* 21 |              TABLE ACCESS STORAGE FULL  | DS3R_FH_1XRTT_FA_LVL_KPI_TEMP
    |    44M|  8193M|       | 34042   (1)| 00:06:49 |     1 |1048575|  Q1,02 | PCWP
    |            |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       2 - filter(SYSDATE@!-40<SYSDATE@!-1)
       9 - filter(SYSDATE@!-40<SYSDATE@!-1)
    PLAN_TABLE_OUTPUT
      10 - access("D1"."CSCD_NM"="D3"."CSCD_NM" AND "D1"."BTS_ID"=TO_NUMBER("D3"."BT
    S_ID"))
      15 - access("D1"."CSCD_NM"="D2"."CSCD_NM" AND "D1"."BTS_ID"=TO_NUMBER("D2"."BT
    S_ID"))
      21 - storage(:Z>=:Z AND :Z<=:Z AND (TRUNC(INTERNAL_FUNCTION("D1"."D_DTM"),'fmd
    d')>=SYSDATE@!-40 AND TRUNC(INTERNAL_FUNCTION("D1"."D_DTM"),'fmdd')<SYSDATE@!-1)
           filter((TRUNC(INTERNAL_FUNCTION("D1"."D_DTM"),'fmdd')>=SYSDATE@!-40 AND T
    PLAN_TABLE_OUTPUT
    RUNC(INTERNAL_FUNCTION("D1"."D_DTM"),'fmdd')<SYSDATE@!-1))
    Note
       - dynamic sampling used for this statement (level=6)
    63 rows selected.
    Create table:
    CREATE TABLE DMSN.DS3R_FH_1XRTT_FA_LVL_KPI_TEMP
      D_DTM                     DATE                NOT NULL,
      F_ID                      NUMBER              NOT NULL,
      REG_DTM                   DATE,
      MRKT_ID                   NUMBER              NOT NULL,
      MRKT_NM                   VARCHAR2(150 BYTE),
      CL_ID                     NUMBER              NOT NULL,
      CL_NM                     VARCHAR2(150 BYTE),
      BSM_ID                    NUMBER              NOT NULL,
      BSM_NM                    VARCHAR2(150 BYTE),
      BSC_SEQ_ID                NUMBER              NOT NULL,
      CSCD_ID                   NUMBER              NOT NULL,
      CSCD_NM                   VARCHAR2(150 BYTE),
      BTS_ID                    NUMBER              NOT NULL,
      SECT_SEQ_ID               NUMBER              NOT NULL,
      BND_ID                    NUMBER              NOT NULL,
      FA_ID                     NUMBER              NOT NULL,
      V_ATT_CNT                 NUMBER,
      V_MBL_ORG_CNT             NUMBER,
      V_MBL_TER_CNT             NUMBER,
      V_SILENT_RETRY_CNT        NUMBER,
      V_CUST_BLK_CNT            NUMBER,
      V_AXS_F_CNT               NUMBER,
      V_CE_BLK_CNT              NUMBER,
      V_WCD_BLK_CNT             NUMBER,
      V_T1_BHL_BLK_CNT          NUMBER,
      V_PWR_BLK_CNT             NUMBER,
      V_NON_BTS_EQ_BLK_CNT      NUMBER,
      V_SFUL_CALL_CNT           NUMBER,
      V_DRP_CALL_CNT            NUMBER,
      D_ATT_CNT                 NUMBER,
      D_MBL_ORG_CNT             NUMBER,
      D_MBL_TER_CNT             NUMBER,
      D_SILENT_RETRY_CNT        NUMBER,
      D_CUST_BLK_CNT            NUMBER,
      D_AXS_F_CNT               NUMBER,
      D_CE_BLK_CNT              NUMBER,
      D_WCD_BLK_CNT             NUMBER,
      D_T1_BHL_BLK_CNT          NUMBER,
      D_PWR_BLK_CNT             NUMBER,
      D_NON_BTS_EQ_BLK_CNT      NUMBER,
      D_SFUL_CALL_CNT           NUMBER,
      D_DRP_CALL_CNT            NUMBER,
      V_PRIM_CALL_ERL           NUMBER,
      V_MOU_TMS                 NUMBER,
      D_PRIM_CALL_ERL           NUMBER,
      SMS_ATT_CNT               NUMBER,
      SMS_SXS_CNT               NUMBER,
      V_HHI_BAD_FRM_CNT         NUMBER,
      V_HHI_CALL_SETUP_SXS_CNT  NUMBER,
      V_HHI_ATT_CNT             NUMBER,
      D_HHI_BAD_FRM_CNT         NUMBER,
      D_HHI_CALL_SETUP_SXS_CNT  NUMBER,
      D_HHI_ATT_CNT             NUMBER,
      BSC_ALTR_ID               VARCHAR2(5 BYTE),
      V_BZ_HH_FLAG              NUMBER(1),
      D_BZ_HH_FLAG              NUMBER(1),
      V_BNCN_BZ_HH_FLAG         NUMBER(1),
      D_BNCN_BZ_HH_FLAG         NUMBER(1),
      V_PRIM_CALL_ERL_N         NUMBER,
      V_MOU_TMS_N               NUMBER
    COMPRESS FOR QUERY LOW
    TABLESPACE DMD_SN_01
    RESULT_CACHE (MODE DEFAULT)
    PCTUSED    0
    PCTFREE    0
    INITRANS   1
    MAXTRANS   255
    STORAGE    (
                PCTINCREASE      5
                BUFFER_POOL      DEFAULT
                FLASH_CACHE      DEFAULT
                CELL_FLASH_CACHE DEFAULT
    PARTITION BY RANGE (D_DTM)
    INTERVAL( NUMTODSINTERVAL(1,'DAY'))
      PARTITION P_1 VALUES LESS THAN (TO_DATE(' 2013-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        LOGGING
        COMPRESS FOR QUERY LOW
        TABLESPACE DMD_SN_01
        PCTFREE    0
        INITRANS   1
        MAXTRANS   255
        STORAGE    (
                    BUFFER_POOL      DEFAULT
                    FLASH_CACHE      DEFAULT
                    CELL_FLASH_CACHE DEFAULT
      PARTITION VALUES LESS THAN (TO_DATE(' 2013-01-28 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        LOGGING
        COMPRESS FOR QUERY LOW
        TABLESPACE DMD_SN_01
        PCTFREE    0
        INITRANS   1
        MAXTRANS   255
        STORAGE    (
                    INITIAL          8M
                    NEXT             1M
                    MINEXTENTS       1
                    MAXEXTENTS       UNLIMITED
                    BUFFER_POOL      DEFAULT
                    FLASH_CACHE      DEFAULT
                    CELL_FLASH_CACHE DEFAULT
      PARTITION VALUES LESS THAN (TO_DATE(' 2013-01-29 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        LOGGING
        COMPRESS FOR QUERY LOW
        TABLESPACE DMD_SN_01
        PCTFREE    0
        INITRANS   1
        MAXTRANS   255
        STORAGE    (
                    INITIAL          8M
                    NEXT             1M
                    MINEXTENTS       1
                    MAXEXTENTS       UNLIMITED
                    BUFFER_POOL      DEFAULT
                    FLASH_CACHE      DEFAULT
                    CELL_FLASH_CACHE DEFAULT
    etc...
    NOCACHE
    PARALLEL ( DEGREE DEFAULT INSTANCES DEFAULT )
    MONITORING;
    CREATE INDEX DMSN.XIF1DS3R_FH_1XRTT_FA_LVL_TEMP ON DMSN.DS3R_FH_1XRTT_FA_LVL_KPI_TEMP
    (BTS_ID, CSCD_NM)
      PCTFREE    10
      INITRANS   2
      MAXTRANS   255
      STORAGE    (
                  BUFFER_POOL      DEFAULT
                  FLASH_CACHE      DEFAULT
                  CELL_FLASH_CACHE DEFAULT
    LOCAL (
      PARTITION P_1
        LOGGING
        NOCOMPRESS
        TABLESPACE DMD_SN_01
        PCTFREE    10
        INITRANS   2
        MAXTRANS   255
        STORAGE    (
                    BUFFER_POOL      DEFAULT
      PARTITION
        LOGGING
        NOCOMPRESS
        TABLESPACE DMD_SN_01
        PCTFREE    10
        INITRANS   2
        MAXTRANS   255
        STORAGE    (
                    INITIAL          64K
                    NEXT             1M
                    MINEXTENTS       1
                    MAXEXTENTS       UNLIMITED
                    BUFFER_POOL      DEFAULT
      PARTITION
        LOGGING
        NOCOMPRESS
        TABLESPACE DMD_SN_01
        PCTFREE    10
        INITRANS   2
        MAXTRANS   255
        STORAGE    (
                    INITIAL          64K
                    NEXT             1M
                    MINEXTENTS       1
                    MAXEXTENTS       UNLIMITED
                    BUFFER_POOL      DEFAULT
    etc....
    NOPARALLEL
    Also, in the v$sql_workarea session, the memory stats seem pretty high...
    ADDRESS
    HASH_VALUE
    SQL_ID
    CHILD_NUMBER
    WORKAREA_ADDRESS
    OPERATION_TYPE
    OPERATION_ID
    POLICY
    ESTIMATED_OPTIMAL_SIZE
    ESTIMATED_ONEPASS_SIZE
    LAST_MEMORY_USED
    LAST_EXECUTION
    LAST_DEGREE
    TOTAL_EXECUTIONS
    OPTIMAL_EXECUTIONS
    ONEPASS_EXECUTIONS
    MULTIPASSES_EXECUTIONS
    ACTIVE_TIME
    MAX_TEMPSEG_SIZE
    LAST_TEMPSEG_SIZE
    000000046CC73120
    3270729960
    gqj9q831g6s78
    0
    000000041C6CE108
    GROUP BY (HASH)
    6
    AUTO
    1175704576
    29911040
    50704384
    OPTIMAL
    24
    189
    189
    0
    0
    13324368
    000000046CC73120
    3270729960
    gqj9q831g6s78
    0
    000000041C6CE0A0
    HASH-JOIN
    10
    AUTO
    15517696
    2760704
    1811456
    OPTIMAL
    24
    192
    192
    0
    0
    20231391
    000000046CC73120
    3270729960
    gqj9q831g6s78
    0
    000000041C6CE038
    HASH-JOIN
    15
    AUTO
    26851328
    4585472
    1797120
    OPTIMAL
    24
    192
    192
    0
    0
    20197157
    000000046CC73120
    3270729960
    gqj9q831g6s78
    0
    000000041C6CDFD0
    BUFFER
    16
    AUTO
    1214464
    580608
    1079296
    OPTIMAL
    1
    192
    192
    0
    0
    20358402
    000000046CC73120
    3270729960
    gqj9q831g6s78
    0
    000000041C6CDF68
    BUFFER
    11
    AUTO
    779264
    510976
    692224
    OPTIMAL
    1
    192
    192
    0
    0
    20396407

    So I may have spoken too soon. I ran the test against the partitioned tabled, and then ran it against the original, which is just indexed and the times weren't that different.
    xPlan with Paritioning:
    SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR);
    PLAN_TABLE_OUTPUT
    SQL_ID  0vtpb0zuf3suj, child number 0
    SELECT COUNT(*) FROM (         SELECT "DDTMDAY", "MRKTNM", "BSMNM",
    "BSCNM", "CLNM", "CSCDNM", "BTSID", "SECTSEQID", "BNDID", "FAID",
    SUM("VATTCNT"), SUM("VMBLORGCNT"), SUM("VMBLTERCNT"),
    SUM("VSILENTRETRYCNT"), SUM("VCUSTBLKCNT"), SUM("VAXSFCNT"),
    SUM("VCEBLKCNT"), SUM("VWCDBLKCNT"), SUM("VT1BHLBLKCNT"),
    SUM("VPWRBLKCNT"), SUM("VNONBTSEQBLKCNT"), SUM("VSFULCALLCNT"),
    SUM("VDRPCALLCNT"), SUM("DATTCNT"), SUM("DMBLORGCNT"),
    SUM("DMBLTERCNT"), SUM("DSILENTRETRYCNT"), SUM("DCUSTBLKCNT"),
    SUM("DAXSFCNT"), SUM("DCEBLKCNT"), SUM("DWCDBLKCNT"),
    PLAN_TABLE_OUTPUT
    SUM("DT1BHLBLKCNT"), SUM("DPWRBLKCNT"), SUM("DNONBTSEQBLKCNT"),
    SUM("DSFULCALLCNT"), SUM("DDRPCALLCNT"), SUM("VPRIMCALLERL"),
    SUM("VMOUTMS"), SUM("DPRIMCALLERL"), SUM("SMSATTCNT"),
    SUM("SMSSXSCNT"), SUM("VHHIATTCNT"), SUM("VHHIBADFRMCNT"),
    SUM("VHHICALLSETUPSXSCNT"), SUM("DHHIATTCNT"), SUM("DHHIBADFRMCNT"),
    SUM("DHHICALLSETUPSXSCNT") FROM (SELECT    trunc(D1."D_DTM", 'dd') AS
    "DDTMDAY",    D2."MRKT_NM" AS "MRKTNM",    D3."BSC_NM" AS "BSMNM",
    D3."BSC_
    Plan hash value: 2810106464
    PLAN_TABLE_OUTPUT
    | Id  | Operation                               | Name
    | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Pstart| Pstop |    TQ  |IN-OUT
    | PQ Distrib |
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT                        |
    |       |       |       | 75444 (100)|          |       |       |        |
    |            |
    |   1 |  SORT AGGREGATE                         |
    |     1 |       |       |            |          |       |       |        |
    |            |
    |*  2 |   PX COORDINATOR                        |
    |       |       |       |            |          |       |       |        |
    PLAN_TABLE_OUTPUT
    |            |
    |   3 |    PX SEND QC (RANDOM)                  | :TQ10003
    |     1 |       |       |            |          |       |       |  Q1,03 | P->S
    | QC (RAND)  |
    |   4 |     SORT AGGREGATE                      |
    |     1 |       |       |            |          |       |       |  Q1,03 | PCWP
    |            |
    |   5 |      VIEW                               |
    PLAN_TABLE_OUTPUT
    |    17M|       |       | 75444   (1)| 00:15:06 |       |       |  Q1,03 | PCWP
    |            |
    |   6 |       HASH GROUP BY                     |
    |    17M|  4409M|  4682M| 75444   (1)| 00:15:06 |       |       |  Q1,03 | PCWP
    |            |
    |   7 |        PX RECEIVE                       |
    |    17M|  4409M|       | 33988   (1)| 00:06:48 |       |       |  Q1,03 | PCWP
    |            |
    PLAN_TABLE_OUTPUT
    |   8 |         PX SEND HASH                    | :TQ10002
    |    17M|  4409M|       | 33988   (1)| 00:06:48 |       |       |  Q1,02 | P->P
    | HASH       |
    |*  9 |          FILTER                         |
    |       |       |       |            |          |       |       |  Q1,02 | PCWC
    |            |
    |* 10 |           HASH JOIN RIGHT OUTER         |
    |    17M|  4409M|       | 33988   (1)| 00:06:48 |       |       |  Q1,02 | PCWP
    |            |
    PLAN_TABLE_OUTPUT
    |  11 |            BUFFER SORT                  |
    |       |       |       |            |          |       |       |  Q1,02 | PCWC
    |            |
    |  12 |             PX RECEIVE                  |
    | 13410 |   261K|       |    15   (0)| 00:00:01 |       |       |  Q1,02 | PCWP
    |            |
    |  13 |              PX SEND BROADCAST          | :TQ10000
    | 13410 |   261K|       |    15   (0)| 00:00:01 |       |       |        | S->P
    PLAN_TABLE_OUTPUT
    | BROADCAST  |
    |  14 |               TABLE ACCESS STORAGE FULL | SITES_SYS_HIERARCHY
    | 13410 |   261K|       |    15   (0)| 00:00:01 |       |       |        |
    |            |
    |* 15 |            HASH JOIN RIGHT OUTER        |
    |    17M|  4077M|       | 33971   (1)| 00:06:48 |       |       |  Q1,02 | PCWP
    |            |
    |  16 |             BUFFER SORT                 |
    PLAN_TABLE_OUTPUT
    |       |       |       |            |          |       |       |  Q1,02 | PCWC
    |            |
    |  17 |              PX RECEIVE                 |
    | 13410 |   667K|       |    34   (0)| 00:00:01 |       |       |  Q1,02 | PCWP
    |            |
    |  18 |               PX SEND BROADCAST         | :TQ10001
    | 13410 |   667K|       |    34   (0)| 00:00:01 |       |       |        | S->P
    | BROADCAST  |
    PLAN_TABLE_OUTPUT
    |  19 |                TABLE ACCESS STORAGE FULL| SITES_GEO_HIERARCHY
    | 13410 |   667K|       |    34   (0)| 00:00:01 |       |       |        |
    |            |
    |  20 |             PX BLOCK ITERATOR           |
    |    17M|  3232M|       | 33934   (1)| 00:06:48 |   KEY |   KEY |  Q1,02 | PCWC
    |            |
    |* 21 |              TABLE ACCESS STORAGE FULL  | DS3R_FH_1XRTT_FA_LVL_KPI_TEMP
    |    17M|  3232M|       | 33934   (1)| 00:06:48 |   KEY |   KEY |  Q1,02 | PCWP
    |            |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       2 - filter(SYSDATE@!-40<SYSDATE@!)
       9 - filter(SYSDATE@!-40<SYSDATE@!)
    PLAN_TABLE_OUTPUT
      10 - access("D1"."CSCD_NM"="D3"."CSCD_NM" AND "D1"."BTS_ID"=TO_NUMBER("D3"."BT
    S_ID"))
      15 - access("D1"."CSCD_NM"="D2"."CSCD_NM" AND "D1"."BTS_ID"=TO_NUMBER("D2"."BT
    S_ID"))
      21 - storage(:Z>=:Z AND :Z<=:Z AND ("D1"."D_DTM">=SYSDATE@!-40 AND "D1"."D_DTM
    "<SYSDATE@!))
           filter(("D1"."D_DTM">=SYSDATE@!-40 AND "D1"."D_DTM"<SYSDATE@!))
    59 rows selected.
    XPLAN NON PARTIONED BUT INDEXED TABLE
    SQL> @C:\TEST.SQL
      COUNT(*)
       1158056
    SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR);
    PLAN_TABLE_OUTPUT
    SQL_ID  5527bmds6pfmq, child number 0
    SELECT COUNT(*) FROM (         SELECT "DDTMDAY", "MRKTNM", "BSMNM",
    "BSCNM", "CLNM", "CSCDNM", "BTSID", "SECTSEQID", "BNDID", "FAID",
    SUM("VATTCNT"), SUM("VMBLORGCNT"), SUM("VMBLTERCNT"),
    SUM("VSILENTRETRYCNT"), SUM("VCUSTBLKCNT"), SUM("VAXSFCNT"),
    SUM("VCEBLKCNT"), SUM("VWCDBLKCNT"), SUM("VT1BHLBLKCNT"),
    SUM("VPWRBLKCNT"), SUM("VNONBTSEQBLKCNT"), SUM("VSFULCALLCNT"),
    SUM("VDRPCALLCNT"), SUM("DATTCNT"), SUM("DMBLORGCNT"),
    SUM("DMBLTERCNT"), SUM("DSILENTRETRYCNT"), SUM("DCUSTBLKCNT"),
    SUM("DAXSFCNT"), SUM("DCEBLKCNT"), SUM("DWCDBLKCNT"),
    PLAN_TABLE_OUTPUT
    SUM("DT1BHLBLKCNT"), SUM("DPWRBLKCNT"), SUM("DNONBTSEQBLKCNT"),
    SUM("DSFULCALLCNT"), SUM("DDRPCALLCNT"), SUM("VPRIMCALLERL"),
    SUM("VMOUTMS"), SUM("DPRIMCALLERL"), SUM("SMSATTCNT"),
    SUM("SMSSXSCNT"), SUM("VHHIATTCNT"), SUM("VHHIBADFRMCNT"),
    SUM("VHHICALLSETUPSXSCNT"), SUM("DHHIATTCNT"), SUM("DHHIBADFRMCNT"),
    SUM("DHHICALLSETUPSXSCNT") FROM (SELECT    trunc(D1."D_DTM", 'dd') AS
    "DDTMDAY",    D2."MRKT_NM" AS "MRKTNM",    D3."BSC_NM" AS "BSMNM",
    D3."BSC_
    Plan hash value: 3388800334
    PLAN_TABLE_OUTPUT
    | Id  | Operation                               | Name                     | Row
    s  | Bytes |TempSpc| Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT                        |                          |
       |       |       | 77843 (100)|          |        |      |            |
    PLAN_TABLE_OUTPUT
    |   1 |  SORT AGGREGATE                         |                          |
    1 |       |       |            |          |        |      |            |
    |*  2 |   PX COORDINATOR                        |                          |
       |       |       |            |          |        |      |            |
    |   3 |    PX SEND QC (RANDOM)                  | :TQ10003                 |
    1 |       |       |            |          |  Q1,03 | P->S | QC (RAND)  |
    |   4 |     SORT AGGREGATE                      |                          |
    PLAN_TABLE_OUTPUT
    1 |       |       |            |          |  Q1,03 | PCWP |            |
    |   5 |      VIEW                               |                          |
    13M|       |       | 77843   (1)| 00:15:35 |  Q1,03 | PCWP |            |
    |   6 |       HASH GROUP BY                     |                          |
    13M|  3523M|  3762M| 77843   (1)| 00:15:35 |  Q1,03 | PCWP |            |
    |   7 |        PX RECEIVE                       |                          |
    13M|  3523M|       | 28163   (1)| 00:05:38 |  Q1,03 | PCWP |            |
    PLAN_TABLE_OUTPUT
    |   8 |         PX SEND HASH                    | :TQ10002                 |
    13M|  3523M|       | 28163   (1)| 00:05:38 |  Q1,02 | P->P | HASH       |
    |*  9 |          FILTER                         |                          |
       |       |       |            |          |  Q1,02 | PCWC |            |
    |* 10 |           HASH JOIN RIGHT OUTER         |                          |
    13M|  3523M|       | 28163   (1)| 00:05:38 |  Q1,02 | PCWP |            |
    |  11 |            BUFFER SORT                  |                          |
       |       |       |            |          |  Q1,02 | PCWC |            |
    PLAN_TABLE_OUTPUT
    |  12 |             PX RECEIVE                  |                          | 134
    10 |   261K|       |    15   (0)| 00:00:01 |  Q1,02 | PCWP |            |
    |  13 |              PX SEND BROADCAST          | :TQ10000                 | 134
    10 |   261K|       |    15   (0)| 00:00:01 |        | S->P | BROADCAST  |
    |  14 |               TABLE ACCESS STORAGE FULL | SITES_SYS_HIERARCHY      | 134
    10 |   261K|       |    15   (0)| 00:00:01 |        |      |            |
    |* 15 |            HASH JOIN RIGHT OUTER        |                          |
    PLAN_TABLE_OUTPUT
    13M|  3266M|       | 28145   (1)| 00:05:38 |  Q1,02 | PCWP |            |
    |  16 |             BUFFER SORT                 |                          |
       |       |       |            |          |  Q1,02 | PCWC |            |
    |  17 |              PX RECEIVE                 |                          | 134
    10 |   667K|       |    34   (0)| 00:00:01 |  Q1,02 | PCWP |            |
    |  18 |               PX SEND BROADCAST         | :TQ10001                 | 134
    10 |   667K|       |    34   (0)| 00:00:01 |        | S->P | BROADCAST  |
    PLAN_TABLE_OUTPUT
    |  19 |                TABLE ACCESS STORAGE FULL| SITES_GEO_HIERARCHY      | 134
    10 |   667K|       |    34   (0)| 00:00:01 |        |      |            |
    |  20 |             PX BLOCK ITERATOR           |                          |
    13M|  2610M|       | 28109   (1)| 00:05:38 |  Q1,02 | PCWC |            |
    |* 21 |              TABLE ACCESS STORAGE FULL  | DS3R_FH_1XRTT_FA_LVL_KPI |
    13M|  2610M|       | 28109   (1)| 00:05:38 |  Q1,02 | PCWP |            |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       2 - filter(SYSDATE@!-40<SYSDATE@!)
       9 - filter(SYSDATE@!-40<SYSDATE@!)
      10 - access("D1"."CSCD_NM"="D3"."CSCD_NM" AND "D1"."BTS_ID"=TO_NUMBER("D3"."BT
    S_ID"))
      15 - access("D1"."CSCD_NM"="D2"."CSCD_NM" AND "D1"."BTS_ID"=TO_NUMBER("D2"."BT
    PLAN_TABLE_OUTPUT
    S_ID"))
      21 - storage(:Z>=:Z AND :Z<=:Z AND ("D1"."D_DTM">=SYSDATE@!-40 AND "D1"."D_DTM
    "<SYSDATE@!))
           filter(("D1"."D_DTM">=SYSDATE@!-40 AND "D1"."D_DTM"<SYSDATE@!))
    59 rows selected.
    SQL>

  • Query result

    The query below has two tables and one view.
    The query functions well but as soon as i add v_date and fin_year conditions, the query shows only matched results.That is the outer join is not showing the desired result.
    I also want those values not in bill_ent and v_bm.
    select  mjcd,v_bm.amt,nvl(sum(gross_amt),0) from mjhd,bill_ent,v_bm
    where mjcd>='2011'
    -- and v_date>='01-MAR-07' and v_date<='29-FEB-08'
    and mjcd=src_mjcd(+)
    and mjcd=h_code(+)
    -- and fin_year='20072008'
    group by mjcd,v_bm.amt
    order by 1
    PLAN_TABLE_OUTPUT
    Plan hash value: 2752209221
    | Id  | Operation              | Name        | Rows  | Bytes | Cost (%CPU)| Time
         |
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT       |             |     1 |    38 |  1016   (7)| 00:0
    0:13 |
    |   1 |  SORT GROUP BY         |             |     1 |    38 |  1016   (7)| 00:0
    0:13 |
    |*  2 |   HASH JOIN OUTER      |             |  1072K|    38M|   968   (2)| 00:0
    0:12 |
    |*  3 |    HASH JOIN OUTER     |             |  1846 | 51688 |    87   (4)| 00:0
    0:02 |
    PLAN_TABLE_OUTPUT
    |*  4 |     TABLE ACCESS FULL  | MJHD        |   364 |  1820 |     2   (0)| 00:0
    0:01 |
    |   5 |     VIEW               | V_BM        |  2365 | 54395 |    84   (3)| 00:0
    0:02 |
    |   6 |      HASH GROUP BY     |             |  2365 | 87505 |    84   (3)| 00:0
    0:02 |
    |*  7 |       TABLE ACCESS FULL| BUDGET_MAST |  2365 | 87505 |    83   (2)| 00:0
    PLAN_TABLE_OUTPUT
    0:01 |
    |*  8 |    TABLE ACCESS FULL   | BILL_ENT    |   212K|  2070K|   875   (1)| 00:0
    0:11 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       2 - access("MJCD"="SRC_MJCD"(+))
       3 - access("MJCD"="H_CODE"(+))
       4 - filter("MJCD">='2011')
       7 - filter(SUBSTR("H_CODE",1,4)>='2011')
       8 - filter("SRC_MJCD"(+)>='2011')The following explin plan is when v_date and fin_year conditions added:
    PLAN_TABLE_OUTPUT
    Plan hash value: 106895325
    | Id  | Operation               | Name        | Rows  | Bytes | Cost (%CPU)| Tim
    e     |
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT        |             |     1 |    48 |   967   (2)| 00:
    00:12 |
    |   1 |  SORT GROUP BY          |             |     1 |    48 |   967   (2)| 00:
    00:12 |
    |*  2 |   HASH JOIN             |             | 49942 |  2341K|   964   (2)| 00:
    00:12 |
    |*  3 |    HASH JOIN            |             |   461 | 13830 |    86   (3)| 00:
    00:02 |
    PLAN_TABLE_OUTPUT
    |*  4 |     TABLE ACCESS FULL   | MJHD        |   364 |  1820 |     2   (0)| 00:
    00:01 |
    |   5 |     VIEW                | V_BM        |   591 | 14775 |    84   (3)| 00:
    00:02 |
    |   6 |      HASH GROUP BY      |             |   591 | 21867 |    84   (3)| 00:
    00:02 |
    |*  7 |       FILTER            |             |       |       |            |
    PLAN_TABLE_OUTPUT
          |
    |*  8 |        TABLE ACCESS FULL| BUDGET_MAST |   591 | 21867 |    83   (2)| 00:
    00:01 |
    |*  9 |    TABLE ACCESS FULL    | BILL_ENT    | 39523 |   694K|   877   (2)| 00:
    00:11 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       2 - access("MJCD"="SRC_MJCD")
       3 - access("MJCD"="H_CODE")
       4 - filter("MJCD">='2011')
       7 - filter(TO_DATE('01-MAR-07')<=TO_DATE('29-FEB-08'))
       8 - filter("FIN_YEAR"='20072008' AND SUBSTR("H_CODE",1,4)>='2011')
       9 - filter("SRC_MJCD">='2011' AND "V_DATE">='01-MAR-07' AND
                  "V_DATE"<='29-FEB-08')Message was edited by:
    MYH

    Check out the SQL Reference for "OUTER JOIN". It says:
    Oracle recommends that you use the FROM clause OUTER JOIN syntax rather than the
    Oracle join operator. Outer join queries that use the Oracle join operator (+) are subject
    to the following rules and restrictions
    then a bunch of points there, and then:
    If the WHERE clause contains a condition that compares a column from table B with a constant, then the (+) operator must be applied to the column so that Oracle returns the rows from table A for which it has generated nulls for this column. Otherwise Oracle returns only the results of a simple join.
    I guess this is where you are stuck...

  • Simple query but not using index..please help??

    I do have this column indexed. Why my query is not using this index?
    Any help .
    select count(*) from v_dis_sub_har;
    SQL>
      COUNT(*)
       4543289
    1 row selected.
    SQL>
    select vzw_vendor_id , count(*)
    from v_dis_sub_har
    group by vzw_vendor_id
    SQL>   2    3    4 
    VZW_VENDOR_ID   COUNT(*)
           200091     908653
           200013     908659
           200012     908659
           200057     908659
           200031     908659
    5 rows selected.
    SQL> SQL>
    explain plan for
    select
    event_seq
    from v_dis_sub_har b 
    where b.VZW_VENDOR_ID='200013'
    -- and b.status='P' and b.extract_date is null
    SQL>   2    3    4    5    6    7 
    Explained.
    SQL> SQL>
    select plan_table_output from table(dbms_xplan.display)
    SQL> SQL>   2 
    PLAN_TABLE_OUTPUT
    Plan hash value: 2852398983
    | Id  | Operation         | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |               |   908K|  7986K|  3132  (16)| 00:00:38 |
    |*  1 |  TABLE ACCESS FULL| V_DIS_SUB_HAR |   908K|  7986K|  3132  (16)| 00:00:38 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - filter("B"."VZW_VENDOR_ID"=200013)
    13 rows selected.
    SQL> SQL>

    You are right Justin. Oracle is not stupid as you may want to say some times when things do not happen according to you. I just created a bitmap index on status field and look what appened. Som times it uses bitmap index and some times it does not. And the reason is clear. Row count by status. 'S' status uses bitmap index where 'P' does not.
    Thanks for your help.
    select   status, count(*)
    from v_dis_sub_har
    group  by status
    ;SQL>   2    3    4 
    S   COUNT(*)
    A    5844982
    P    2312759
    S      20178
    3 rows selected.
    SQL>
    explain plan for
    select
    event_seq
    from v_dis_sub_har b 
    where
    --b.VZW_VENDOR_ID=200013
    --  and
    b.status='S'
    --and b.extract_date is null
    select plan_table_output from table(dbms_xplan.display)
    SQL>   2    3    4    5    6    7    8    9   10 
    Explained.
    SQL> SQL> SQL> SQL>   2 
    PLAN_TABLE_OUTPUT
    Plan hash value: 829738689
    | Id  | Operation                    | Name                         | Rows  | Bytes | Cost (%CPU)| T
    ime     |
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT             |                              | 20290 |   118K|  2772   (1)| 0
    0:00:34 |
    |   1 |  TABLE ACCESS BY INDEX ROWID | V_DIS_SUB_HAR                | 20290 |   118K|  2772   (1)| 0
    0:00:34 |
    |   2 |   BITMAP CONVERSION TO ROWIDS|                              |       |       |            |
            |
    |*  3 |    BITMAP INDEX SINGLE VALUE | V_DISPATCH_SUBSCRIPTION_NDX2 |       |       |            |
            |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       3 - access("B"."STATUS"='S')
    15 rows selected.
    SQL> SQL> set line 120
    SQL> /
    PLAN_TABLE_OUTPUT
    Plan hash value: 829738689
    | Id  | Operation                    | Name                         | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |                              | 20290 |   118K|  2772   (1)| 00:00:34 |
    |   1 |  TABLE ACCESS BY INDEX ROWID | V_DIS_SUB_HAR                | 20290 |   118K|  2772   (1)| 00:00:34 |
    |   2 |   BITMAP CONVERSION TO ROWIDS|                              |       |       |            |          |
    |*  3 |    BITMAP INDEX SINGLE VALUE | V_DISPATCH_SUBSCRIPTION_NDX2 |       |       |            |          |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       3 - access("B"."STATUS"='S')
    15 rows selected.
    SQL>
    explain plan for
    select
    event_seq
    from v_dis_sub_har b 
    where
    --b.VZW_VENDOR_ID=200013
    --  and
    b.status='P'
    --and b.extract_date is null
    select plan_table_output from table(dbms_xplan.display)
          SQL>   2    3    4    5    6    7    8    9   10 
    Explained.
    SQL> SQL> SQL> SQL>   2 
    PLAN_TABLE_OUTPUT
    Plan hash value: 2852398983
    | Id  | Operation         | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |               |  2325K|    13M|  5784  (18)| 00:01:10 |
    |*  1 |  TABLE ACCESS FULL| V_DIS_SUB_HAR |  2325K|    13M|  5784  (18)| 00:01:10 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - filter("B"."STATUS"='P')
    13 rows selected.
    SQL>

  • Tune Query with Millions of Records

    Hi everyone,
    I've got an Oracle 11g tuning task set before me and I'm pretty novice when it comes to tuning.
    The query itself is only about 10-15 lines of SQL, however, it's hitting four tables, one of them is 100 million records and one is 8 million. The other two are pretty small comparatively ( 6,000 and 300 records). The problem I am having is that the query actually needs to aggregate 3 million records.
    I found an article about using the star_transformation_enabled = true parameter, then on the fact table I set all the foreign key to bitmaps and the dimensions have a standard primary key defined on the surrogate key. This strategy works but it still takes a long time for the query to crunch the 3 million records (takes about 30 minutes).
    I know there's also the option of doing materialized views and using query re-write to take advantage of the MV, but my problem with that is that we're using OBIEE and we can't control how many different variations of these query's we see. So we would have to make a ton of MVs.
    What are the best ways to tackle high volume queries like this from a system wide perspective?
    Are there any benchmarks for what I should be seeing in terms of a 3 million record query? Is expecting under a minute even reasonable?
    Any help would be appreciated!
    Thanks!
    -Joe

    Here is the trace information:
    SQL> set autotrace traceonly arraysize 1000
    SQL> SELECT SUM(T91573.ACTIVITY_GLOBAL1_AMT) AS c2,
      2    SUM(
      3    CASE
      4      WHEN T91573.DB_CR_IND = 'CREDIT'
      5      THEN T91573.ACTIVITY_GLOBAL1_AMT
      END )                           AS c3,
      T91397.GL_ACCOUNT_NAME          AS c4,
      6    7    8    T91397.GROUP_ACCOUNT_NUM        AS c5,
      9    SUM(T91573.BALANCE_GLOBAL1_AMT) AS c6,
    10    T156337.ROW_WID                 AS c7
    11  FROM W_MCAL_DAY_D T156337
    12    /* Dim_W_MCAL_DAY_D_Fiscal_Day */
    13    ,
    14    W_INT_ORG_D T111515
      /* Dim_W_INT_ORG_D_Company */
    15   16    ,
      W_GL_ACCOUNT_D T91397
    17   18    /* Dim_W_GL_ACCOUNT_D */
    19    ,
    20    W_GL_BALANCE_F T91573
      /* Fact_W_GL_BALANCE_F */
    21   22  WHERE ( T91397.ROW_WID        = T91573.GL_ACCOUNT_WID
    23  AND T91573.COMPANY_ORG_WID    = T111515.ROW_WID
    24  AND T91573.BALANCE_DT_WID     = T156337.ROW_WID
    AND T111515.COMPANY_FLG       = 'Y'
    AND T111515.ORG_NUM           = '02000'
    25   26   27  AND T156337.MCAL_PER_NAME_QTR = '2010 Q 1' )
    28  GROUP BY T91397.GL_ACCOUNT_NAME,
      T91397.GROUP_ACCOUNT_NUM,
    29   30    T156337.ROW_WID
    31  ;
    522 rows selected.
    Execution Plan
    Plan hash value: 2761996426
    | Id  | Operation                              | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                       |                            |  7882 |   700K|  7330   (1)| 00:01:28 |
    |   1 |  HASH GROUP BY                         |                            |  7882 |   700K|  7330   (1)| 00:01:28 |
    |*  2 |   HASH JOIN                            |                            |  7882 |   700K|  7329   (1)| 00:01:28 |
    |   3 |    VIEW                                | VW_GBC_13                  |  7837 |   390K|  6534   (1)| 00:01:19 |
    |   4 |     TEMP TABLE TRANSFORMATION          |                            |       |       |            |          |
    |   5 |      LOAD AS SELECT                    | SYS_TEMP_0FD9D7416_F97A325 |       |       |            |          |
    |*  6 |       VIEW                             | index$_join$_114           |   572 | 10296 |   191   (9)| 00:00:03 |
    |*  7 |        HASH JOIN                       |                            |       |       |            |          |
    |   8 |         BITMAP CONVERSION TO ROWIDS    |                            |   572 | 10296 |     1   (0)| 00:00:01 |
    |*  9 |          BITMAP INDEX SINGLE VALUE     | W_MCAL_DAY_D_F46           |       |       |            |          |
    |  10 |         INDEX FAST FULL SCAN           | W_MCAL_DAY_D_P1            |   572 | 10296 |   217   (1)| 00:00:03 |
    |  11 |      HASH GROUP BY                     |                            |  7837 |   290K|  6343   (1)| 00:01:17 |
    |* 12 |       HASH JOIN                        |                            | 26186 |   971K|  6337   (1)| 00:01:17 |
    |  13 |        TABLE ACCESS FULL               | SYS_TEMP_0FD9D7416_F97A325 |   572 |  5148 |     2   (0)| 00:00:01 |
    |  14 |        TABLE ACCESS BY INDEX ROWID     | W_GL_BALANCE_F             | 26186 |   741K|  6334   (1)| 00:01:17 |
    |  15 |         BITMAP CONVERSION TO ROWIDS    |                            |       |       |            |          |
    |  16 |          BITMAP AND                    |                            |       |       |            |          |
    |  17 |           BITMAP MERGE                 |                            |       |       |            |          |
    |  18 |            BITMAP KEY ITERATION        |                            |       |       |            |          |
    |* 19 |             TABLE ACCESS BY INDEX ROWID| W_INT_ORG_D                |     2 |    32 |     3   (0)| 00:00:01 |
    |* 20 |              INDEX RANGE SCAN          | W_INT_ORG_ORG_NUM          |     2 |       |     1   (0)| 00:00:01 |
    |* 21 |             BITMAP INDEX RANGE SCAN    | W_GL_BALANCE_F_F4          |       |       |            |          |
    |  22 |           BITMAP MERGE                 |                            |       |       |            |          |
    |  23 |            BITMAP KEY ITERATION        |                            |       |       |            |          |
    |  24 |             TABLE ACCESS FULL          | SYS_TEMP_0FD9D7416_F97A325 |   572 |  5148 |     2   (0)| 00:00:01 |
    |* 25 |             BITMAP INDEX RANGE SCAN    | W_GL_BALANCE_F_F1          |       |       |            |          |
    |  26 |    VIEW                                | index$_join$_003           |   199K|  7775K|   794   (5)| 00:00:10 |
    |* 27 |     HASH JOIN                          |                            |       |       |            |          |
    |* 28 |      HASH JOIN                         |                            |       |       |            |          |
    |  29 |       BITMAP CONVERSION TO ROWIDS      |                            |   199K|  7775K|    26   (0)| 00:00:01 |
    |  30 |        BITMAP INDEX FULL SCAN          | W_GL_ACCOUNT_D_M1          |       |       |            |          |
    |  31 |       BITMAP CONVERSION TO ROWIDS      |                            |   199K|  7775K|   118   (0)| 00:00:02 |
    |  32 |        BITMAP INDEX FULL SCAN          | W_GL_ACCOUNT_D_M10         |       |       |            |          |
    |  33 |      INDEX FAST FULL SCAN              | W_GL_ACCOUNT_D_M18         |   199K|  7775K|   733   (1)| 00:00:09 |
    Predicate Information (identified by operation id):
       2 - access("T91397"."ROW_WID"="ITEM_1")
       6 - filter("T156337"."MCAL_PER_NAME_QTR"='2010 Q 1')
       7 - access(ROWID=ROWID)
       9 - access("T156337"."MCAL_PER_NAME_QTR"='2010 Q 1')
      12 - access("T91573"."BALANCE_DT_WID"="C0")
      19 - filter("T111515"."COMPANY_FLG"='Y')
      20 - access("T111515"."ORG_NUM"='02000')
      21 - access("T91573"."COMPANY_ORG_WID"="T111515"."ROW_WID")
      25 - access("T91573"."BALANCE_DT_WID"="C0")
      27 - access(ROWID=ROWID)
      28 - access(ROWID=ROWID)
    Note
       - star transformation used for this statement
    Statistics
           1067  recursive calls
              9  db block gets
         417513  consistent gets
         296603  physical reads
           6708  redo size
          25220  bytes sent via SQL*Net to client
            520  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              6  sorts (memory)
              0  sorts (disk)
            522  rows processedAnd here is the cursor details:
    SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
    PLAN_TABLE_OUTPUT
    SQL_ID  6s625d3821nq3, child number 0
    SELECT /*+ gather_plan_statistics */ SUM(T91573.ACTIVITY_GLOBAL1_AMT)
    AS c2,   SUM(   CASE     WHEN T91573.DB_CR_IND = 'CREDIT'     THEN
    T91573.ACTIVITY_GLOBAL1_AMT   END )                           AS c3,
    T91397.GL_ACCOUNT_NAME          AS c4,   T91397.GROUP_ACCOUNT_NUM
    AS c5,   SUM(T91573.BALANCE_GLOBAL1_AMT) AS c6,   T156337.ROW_WID
               AS c7 FROM W_MCAL_DAY_D T156337   /*
    Dim_W_MCAL_DAY_D_Fiscal_Day */   ,   W_INT_ORG_D T111515   /*
    Dim_W_INT_ORG_D_Company */   ,   W_GL_ACCOUNT_D T91397   /*
    Dim_W_GL_ACCOUNT_D */   ,   W_GL_BALANCE_F T91573   /*
    PLAN_TABLE_OUTPUT
    Fact_W_GL_BALANCE_F */ WHERE ( T91397.ROW_WID        =
    T91573.GL_ACCOUNT_WID AND T91573.COMPANY_ORG_WID    = T111515.ROW_WID
    AND T91573.BALANCE_DT_WID     = T156337.ROW_WID AND T111515.COMPANY_FLG
          = 'Y' AND T111515.ORG_NUM           = '02000' AND
    T156337.MCAL_PER_NAME_QTR = '2010 Q 1' ) GROUP BY
    T91397.GL_ACCOUNT_NAME,   T91397.GROUP_ACCOUNT_NUM,   T156337.ROW_WID
    Plan hash value: 3262111942
    PLAN_TABLE_OUTPUT
    | Id  | Operation                              | Name                       | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  | Writes |  OMem |  1Mem| Used-Mem |
    |   0 | SELECT STATEMENT                       |                            |   1 |        |    522 |00:51:34.16 |     424K|    111K|      2 |       |       |          |
    |   1 |  HASH GROUP BY                         |                            |   1 |   7882 |    522 |00:51:34.16 |     424K|    111K|      2 |   748K|   748K| 1416K (0)|
    |*  2 |   HASH JOIN                            |                            |   1 |   7882 |   5127 |00:51:34.00 |     424K|    111K|      2 |  1035K|  1035K| 1561K (0)|
    |   3 |    VIEW                                | VW_GBC_13                  |   1 |   7837 |   5127 |00:51:32.65 |     423K|    111K|      2 |       |       |          |
    |   4 |     TEMP TABLE TRANSFORMATION          |                            |   1 |        |   5127 |00:51:32.64 |     423K|    111K|      2 |       |       |          |
    |   5 |      LOAD AS SELECT                    |                            |   1 |        |      0 |00:00:00.09 |     188 |      0 |      2 |   269K|   269K|  269K (0)|
    |*  6 |       VIEW                             | index$_join$_114           |   1 |    572 |    724 |00:00:00.01 |     183 |      0 |      0 |       |       |          |
    |*  7 |        HASH JOIN                       |                            |   1 |        |    724 |00:00:00.01 |     183 |      0 |      0 |  1011K|  1011K| 1573K (0)|
    |   8 |         BITMAP CONVERSION TO ROWIDS    |                            |   1 |    572 |    724 |00:00:00.01 |       3 |      0 |      0 |       |       |          |
    |*  9 |          BITMAP INDEX SINGLE VALUE     | W_MCAL_DAY_D_F46           |   1 |        |      1 |00:00:00.01 |       3 |      0 |      0 |       |       |          |
    |  10 |         INDEX FAST FULL SCAN           | W_MCAL_DAY_D_P1            |   1 |    572 |  64822 |00:00:00.06 |     180 |      0 |      0 |       |       |          |
    |  11 |      HASH GROUP BY                     |                            |   1 |   7837 |   5127 |00:51:32.54 |     423K|    111K|      0 |  1168K|  1038K| 2598K (0)|
    |* 12 |       HASH JOIN                        |                            |   1 |  26186 |   3267K|03:18:27.02 |     423K|    111K|      0 |  1236K|  1236K| 1248K (0)|
    |  13 |        TABLE ACCESS FULL               | SYS_TEMP_0FD9D73B3_F97A325 |   1 |    572 |    724 |00:00:00.02 |       7 |      2 |      0 |       |       |          |
    |  14 |        TABLE ACCESS BY INDEX ROWID     | W_GL_BALANCE_F             |   1 |  26186 |   3267K|03:18:12.81 |     423K|    111K|      0 |       |       |          |
    |  15 |         BITMAP CONVERSION TO ROWIDS    |                            |   1 |        |   3267K|00:00:06.29 |   16142 |   1421 |      0 |       |       |          |
    |  16 |          BITMAP AND                    |                            |   1 |        |     74 |00:00:03.06 |   16142 |   1421 |      0 |       |       |          |
    |  17 |           BITMAP MERGE                 |                            |   1 |        |     83 |00:00:00.08 |     393 |      0 |      0 |  1024K|   512K| 2754K (0)|
    |  18 |            BITMAP KEY ITERATION        |                            |   1 |        |    764 |00:00:00.01 |     393 |      0 |      0 |       |       |          |
    |* 19 |             TABLE ACCESS BY INDEX ROWID| W_INT_ORG_D                |   1 |      2 |      2 |00:00:00.01 |       3 |      0 |      0 |       |       |          |
    |* 20 |              INDEX RANGE SCAN          | W_INT_ORG_ORG_NUM          |   1 |      2 |      2 |00:00:00.01 |       1 |      0 |      0 |       |       |          |
    |* 21 |             BITMAP INDEX RANGE SCAN    | W_GL_BALANCE_F_F4          |   2 |        |    764 |00:00:00.01 |     390 |      0 |      0 |       |       |          |
    |  22 |           BITMAP MERGE                 |                            |   1 |        |    210 |00:00:03.12 |   15749 |   1421 |      0 |    57M|  7389K|   17M (3)|
    |  23 |            BITMAP KEY ITERATION        |                            |   4 |        |  16405 |00:00:15.36 |   15749 |   1421 |      0 |       |       |          |
    |  24 |             TABLE ACCESS FULL          | SYS_TEMP_0FD9D73B3_F97A325 |   4 |    572 |   2896 |00:00:00.05 |      16 |      6 |      0 |       |       |          |
    |* 25 |             BITMAP INDEX RANGE SCAN    | W_GL_BALANCE_F_F1          |2896 |        |  16405 |00:00:24.99 |   15733 |   1415 |      0 |       |       |          |
    |  26 |    VIEW                                | index$_join$_003           |   1 |    199K|    199K|00:00:02.50 |     737 |      1 |      0 |       |       |          |
    |* 27 |     HASH JOIN                          |                            |   1 |        |    199K|00:00:02.18 |     737 |      1 |      0 |    14M|  2306K|   17M (0)|
    |* 28 |      HASH JOIN                         |                            |   1 |        |    199K|00:00:01.94 |     144 |      1 |      0 |    10M|  2639K|   13M (0)|
    |  29 |       BITMAP CONVERSION TO ROWIDS      |                            |   1 |    199K|    199K|00:00:00.19 |      26 |      0 |      0 |       |       |          |
    |  30 |        BITMAP INDEX FULL SCAN          | W_GL_ACCOUNT_D_M1          |   1 |        |     93 |00:00:00.01 |      26 |      0 |      0 |       |       |          |
    |  31 |       BITMAP CONVERSION TO ROWIDS      |                            |   1 |    199K|    199K|00:00:01.05 |     118 |      1 |      0 |       |       |          |
    |  32 |        BITMAP INDEX FULL SCAN          | W_GL_ACCOUNT_D_M10         |   1 |        |   5791 |00:00:00.01 |     118 |      1 |      0 |       |       |          |
    |  33 |      INDEX FAST FULL SCAN              | W_GL_ACCOUNT_D_M18         |   1 |    199K|    199K|00:00:00.19 |     593 |      0 |      0 |       |       |          |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       2 - access("T91397"."ROW_WID"="ITEM_1")
       6 - filter("T156337"."MCAL_PER_NAME_QTR"='2010 Q 1')
       7 - access(ROWID=ROWID)
       9 - access("T156337"."MCAL_PER_NAME_QTR"='2010 Q 1')
      12 - access("T91573"."BALANCE_DT_WID"="C0")
      19 - filter("T111515"."COMPANY_FLG"='Y')
      20 - access("T111515"."ORG_NUM"='02000')
      21 - access("T91573"."COMPANY_ORG_WID"="T111515"."ROW_WID")
      25 - access("T91573"."BALANCE_DT_WID"="C0")
      27 - access(ROWID=ROWID)
      28 - access(ROWID=ROWID)
    PLAN_TABLE_OUTPUT
    Note
       - star transformation used for this statement
    78 rows selected.Can any suggest a way to improve the performance? Or even hint at a good place for me to start looking?
    Please let me know if there is any additional information I can give.
    -Joe

Maybe you are looking for

  • How do I stop firefox from remembering my passwords?

    I want firefox not to remember the my passwords in this computer as I will not be using this computer anymore. How do I stop password remembering feature>

  • Wrong document URL for content server

    Hi, In my code I'm getting the url of an image by using the function: CALL FUNCTION 'CVAPI_DOC_VIEW'    EXPORTING      PF_DOKAR               = it_objectlinks-documenttype      PF_DOKNR               = it_objectlinks-documentnumber      PF_DOKVR     

  • Rebate Agreement manual accruals not updating in agreement

    Hello, I am configuring extended rebate agreements and am working with the MANUAL ACCRUAL functionality.  I can create a manual accrual from the agreement and sales order type B4 is created and billed as type B4.  I can see the impact correctly to th

  • Why won't my iPad 2 charge above 50%?

    I recieved my iPad 2 as a gift in October of 2011. Up until now I've had no problems. Yesterday I had depleted my battery to about 7%, so I plugged it in for at least 4 hours while I went for a walk. When I came back the gauge said only 50%. I used i

  • Is WS2012R2E Capable of Bare Metal Restore to UEFI Client?

    Hi, After two weeks of fruitless effort attempting a client bare metal restore to a UEFI machine, I'm now wondering if it is supported in W2012R2E? This same machine is able to use WDS over the network to do a remote software install. Similarly, two