Oracle taking a strange query execution path

I have a query which is admittedly a bit unconventional but Oracle is really doing something strange with it...
SELECT   GROUP_CODE, STATUS, COL3, COL4, ETC...
FROM MAIN_TABLE A
WHERE A.STATUS = 'COMPLETE' -- ONLY GET COMPLETE RECORDS...
    -- AND ONLY FOR THOSE WHERE THERE ARE NO INCOMPLETE RECORDS IN THE SAME GROUP
    AND (SELECT COUNT(*) FROM MAIN_TABLE B WHERE B.GROUP_CODE = A.GROUP_CODE AND B.STATUS != 'COMPLETE') = 0
ORDER BY GROUP_CODE  
[\CODE]
This query is done on a table of ~100k records, and the result should only return about 100 or so records.
The only index in the table is on GROUP_CODE, and statistics are up-to-date.
The strange part is that the query takes over an hour to complete, UNLESS I take out the ORDER BY, then it takes only a few seconds!!!  The difference is that with the ORDER BY, it is using the GROUP_CODE index (even with a */*+ NO_INDEX(MAIN_TABLE) */* hint in the query).
How can I either reorganize this query or prevent Oracle from taking the "incorrect" path?
Edited by: xaeryan on May 20, 2011 3:01 PM
Edited by: xaeryan on May 20, 2011 3:02 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

try something as below..
select *
from
     select GROUP_CODE, STATUS, COL3, COL4, ETC...,
     max(case when STATUS != 'COMPLETE' then 1 ELSE 0 END) over( partition by  GROUP_CODE) as mx
     from
     MAIN_TABLE
)X
where mx= 0 HTH...

Similar Messages

  • Query execution taking longer time in Oracle form 10g !!

    Hi,
    I'm generating a report through Oracle form ( forms 10g) and its taking 3-4 hours to finish. But when I run the same report query in (Oracle 11g) database, it gets executed in less than 40 mins.
    The form takes only from and to date as input.
    I tried hardcoring the date in the Oracle Form and then the report takes only 40 mins to generate.
    I tried various approaches like changing the datatypes of form variable and correspondingly changing the query, but met with no success.
    When the report in run through the form , we can see the query getting run in backend for nearly 3 hrs !!! tats really confusing !!
    Please let me know, if anybody got any idea on this problem??

    Hi,
    Even I am facing the same problem above. I am trying to fetch results from a cursor which has subquery running over the db link and placing the results set in a csv file using client_io package. When I run the cursor directly from database (11G), it takes not more than 3-4 min to get the results back. But when I run the same cursor via oracle forms 10G, the query in local database keep on waiting for hours to get results from remote database with "SQL*Net message from dblink". Session on local database remains in active status with state as "Waiting" while the session on remote database goes inactive with state as waiting for event "SQL*Net message from client"
    This is confusing me since the same query when ran directly from backend fetches results soon.
    Please let me know if anyone can help here
    Thanks
    Garima

  • Query Execution/Elapsed Time and Oracle Data Blocks

    Hi,
    I have created 3 tables with one column only. As an example Table 1 below:
    SQL> create table T1 ( x char(2000));
    So 3 tables are created in this way i.e. T1,T2 and T3.
    T1 = in the default database tablespace of 8k (11g v11.1.0.6.0 - Production) (O.S=Windows).
    T2 = I created in a Tablespace with Blocksize 16k.
    T3 = I created in a Tablespace with Blocksize 4k. In the same Instance.
    Each table has approx. 500 rows (So, table sizes are same in all the cases to test Query execution time ). As these 3 tables are created under different data block sizes so the ALLOCATED no. of data blocks are different in all cases.
    T1  =   8k  = 256 Blocks =  00:00:04.76 (query execution time/elapsed time)
    T2  = 16k=121 Blocks =  00:00:04.64
    T3 =   4k =  490 Blocks =  00:00:04.91
    Table Access is FULL i.e. I have used select * from table_name; in all 3 cases. No Index nothing.
    My Question is why query execution time is nearly the same in all 3 cases because Oracle has to read all the data blocks in each case to fetch the records and there is a much difference in the allocated no. of blocks ???
    In 4k block size example, Oracle has to read just 121 blocks and it's taking nearly the same time as it's taking to read 490 blocks???
    This is just 1 example of different data blocks. I have around 40 tables in each block size tablespace and the result are nearly the same. It's very strange for me because there is a much difference in the no. of allocated blocks but execution time is almost the same, only difference in milliseconds.
    I'll highly appreciate the expert opinions.
    Bundle of thanks in advance.
    Best Regards,

    Hi Chris,
    No I'm not using separate databases, it's 8k database with non-standard blocksizes of 16k and 4k.
    Actually I wanted to test the Elapsed time of these 3 tables, so for that I tried to create the same size
    tables.
    And how I equalize these is like I have created one column table with char(2000).
    555 MB is the figure I wanted to use for these 3 tables ( no special figure, just to make it bigger than the
    RAM used for my db at the db startup to be sure of not retrieving the records from cache).
    so row size with overhead is 2006 * 290,000 rows = 581740000(bytes) / 1024 = 568105KB / 1024 = 555MB.
    Through this math calculation I thought It will be the total table size. So I Created the same no. of rows in 3 blocksizes.
    If it's wrong then what a mes because I was calculating tables sizes in the same way from the last few months.
    Can you please explain a little how you found out the tables sizes in different block sizes.Though I understood how you
    calculated size in MB from these 3 block sizes
    T8K =97177 BLOCKS=759MB *( 97177*8 = 777416KB / 1024 = 759MB )*
    T16K=41639 BLOCKS=650MB
    BT4K=293656 BLOCKS=1147MB
    For me it's new to calculate the size of a table. Can you please tell me then how many rows I can create in each of
    these 3 tables to make them equal in MB to test for elapsed time.
    Then I'll again run my test and put the results here. Because If I've wrongly calculated table sizes then there is no need to talk about elapsed time. First I must equalize the table sizes properly.
    SQL> select sum(bytes)/1024/1024 "Size in MB" from dba_segments> 2 where segment_name = 'T16K';
    Size in MB
    655
    Is above SQL is correct to calculate the size or is it the correct alternative way to your method of calculating the size??
    I created the same table again with everything same and the result is :
    SQL> select num_rows,blocks from user_tables where table_name = 'T16K';NUM_ROWS BLOCKS
    290000 41703
    64 more blocks are allocated this time so may be that's y it's showing total size of 655 instead of 650.
    Thanks alot for your help.
    Best Regards,
    KAm
    Edited by: kam555 on Nov 20, 2009 5:57 PM

  • Problem with different execution paths in hierarchical query

    Hello,
    I have problems with the following query:
    SELECT DISTINCT P.ID FROM PRODUCTELEMENTIMPL P WHERE ( ( LABEL = 'SomeLabel' AND PRODUCTELEMENTTYPE = 'SomeText' AND ( STATE = 'created' OR STATE = 'stored' OR STATE = 'archived' OR STATE = 'archivedRestored' ) ) ) START WITH P.ID = 42 CONNECT BY PRIOR P.ID = P.PARENT
    We have two databases (an Oracle 10g XE and Oracle10g Enterprise). In the XE Database the query is executed very fast, but in the main installation it takes minutes. If I "explain" the query I get two different execution paths:
    The fast:
    ID      PARENT_ID      LEVEL      SQL      Kosten      Anzahl Zeilen
    0      -      1      SELECT STATEMENT      20      49
    1      0      2      HASH UNIQUE      20      49
    2      1      3      FILTER      -      -
    3      2      4      CONNECT BY WITH FILTERING      -      -
    4      3      5      TABLE ACCESS BY INDEX ROWID PRODUCTELEMENTIMPL (TABLE)      -      -
    5      4      6      INDEX UNIQUE SCAN SYS_C0072201 (INDEX (UNIQUE))      2      1
    6      3      5      NESTED LOOPS      -      -
    7      6      6      BUFFER SORT      -      -
    8      7      7      CONNECT BY PUMP      -      -
    9      6      6      TABLE ACCESS BY INDEX ROWID PRODUCTELEMENTIMPL (TABLE)      19      49
    10      9      7      INDEX RANGE SCAN PRODUCTELEMENTIMPL_IDX1 (INDEX)      3      49
    11      3      5      TABLE ACCESS FULL PRODUCTELEMENTIMPL (TABLE)      19      49
    Slow:
    ID PARENT_ID LEVEL SQL Kosten Anzahl Zeilen
    0 1 SELECT STATEMENT 1 1
    1 0 2 HASH UNIQUE 1 1
    2 1 3 FILTER
    3 2 4 CONNECT BY WITHOUT FILTERING
    4 3 5 TABLE ACCESS BY INDEX ROW 3 1
    ID PRODUCTELEMENTIMPL (TABLE)
    5 4 6 INDEX UNIQUE SCAN SYS_C0 2 1
    020528 (INDEX (UNIQUE))
    6 3 5 TABLE ACCESS FULL PRODUCT 6628 1100613
    ELEMENTIMPL (TABLE)
    Any ideas how to avoid this full table scan?
    bye
    Roland Spatzenegger

    Hello,
    thank you for your replies. The indices and table schemas are the "same", but only the content for the tables was mirrored.
    We made some tests with dropping and/or analyzing the tables, but it didn't change anything.
    The main problem is that the query takes 33s in the productive environment for searching in a couple of rows. At the moment it's faster to make
    SELECT DISTINCT P.ID, P.STATE FROM PRODUCTELEMENTIMPL P WHERE ( ( LABEL = 'SomeLabel' AND PRODUCTELEMENTTYPE = 'SomeText' ) ) START WITH P.ID = 42 CONNECT BY PRIOR P.ID = P.PARENT
    and to test in the application if the state-values match ;-)
    If I add the hint /*+ no_filtering */ in the test environment, I get the same "slow" execution path as in the production environment. So the question is, what prevents the filtering in "connect by"?
    (I think in the fast version it filters only the results of the hierarchical query, in the slow version it first filters the whole table and joins/merge it with the hierachical result).
    bye
    Roland Spatzenegger

  • Oracle View that stores the Query execution time

    Hi Gurus
    i m using Oracle 10G in Unix. I wudiold like to know which Data dictionary view stores the execution of a query. If it is not stored then hw to find the query execution time other than (Set timing on) command. What is the use of elapsed time and what is the difference between execution time and elapsed time? How to calculate the execution time of a query.
    THanks
    Ram

    If you have a specific query you're going to run in SQL*Plus, just do
    a 'set timing on' before you execute the query.
    If you've got application SQL coming in from all over the place, you can
    identify specific SQL in V$SQL/ and look at ELAPSED_TIME/EXECUTIONS
    to get an average elapsed time.
    If you've got an application running SQL, and you need to know the
    specific timing of a specific execution (as opposed to an average),
    you can use DBMS_SUPPORT to set trace in the session that your
    application is running in, and then use TkProf to process the resulting
    trace file.

  • Query Execution taking Longer Time

    Hi BI Gurus,
    There is one some ABC query which was built on multiprovider, when I am trying to execute it in BEx analyzer in production system it is taking long run and then giving short dump. I have checked data in the multiprovider it is not more than 1lac records. Can any one tell me what is the problem and how can I find the roote cause?
    Thanks in advance,
    Venkat

    Hi,
    Even I am facing the same problem above. I am trying to fetch results from a cursor which has subquery running over the db link and placing the results set in a csv file using client_io package. When I run the cursor directly from database (11G), it takes not more than 3-4 min to get the results back. But when I run the same cursor via oracle forms 10G, the query in local database keep on waiting for hours to get results from remote database with "SQL*Net message from dblink". Session on local database remains in active status with state as "Waiting" while the session on remote database goes inactive with state as waiting for event "SQL*Net message from client"
    This is confusing me since the same query when ran directly from backend fetches results soon.
    Please let me know if anyone can help here
    Thanks
    Garima

  • Master data taking Long time in Query Execution

    hello Experts
    I have an issue while executing a query.
    The input parameter for the query is the 0customer variable in which when I try to select the value from the tab  Select From the List & goes for single value option or any other option then goes for long time loading the values & then come out with a short dump.
    I want to know why this is happening.
    Please help me out from this.
    Thanks in advance
    Neha

    Thanks to All
    I have checked the info Object - 0Customer.
    The following settings are there in Bex Explorer tab ::
    Query Def. Filter Value Selection  -  Values in Master Data Table
    Query Execution Filter Val. Selectn  -  Only Posted Values for navigation
    Also the Value for display in the object are only 1000. This takes time only in analyzer not in designer.
    What I have to do, plz suggest
    Thanks
    Neha

  • Inline subquery cardinality wrong, execution path not correct

    hi:
    i have a simple query , I just can not get the execution path correct. please advice .
    SELECT *
    FROM fcst_budget a,
    SELECT *
    FROM fcst_root_facility_all
    WHERE salesman IN (200)
    ) b
    WHERE a.ci=b.ci AND a.facility=b.facility
    Plan
    SELECT STATEMENT ALL_ROWSCost: 2,276 Bytes: 1,317,411 Cardinality: 1,593
    3 HASH JOIN Cost: 2,276 Bytes: 1,317,411 Cardinality: 1,593
    1 INDEX FAST FULL SCAN INDEX (UNIQUE) SALES.FCST_ROOT_FACILITY_ALL_PK Cost: 1,466 Bytes: 331,660 Cardinality: 515
    2 TABLE ACCESS FULL TABLE SALES.FCST_BUDGET Cost: 807 Bytes: 27,628,425 Cardinality: 150,975
    fcst_root_facility_all has 50K records, with index on salesman, pk = ci,facility
    fcst_budget has 150K records, pk= ci,facility,yr_prd
    the problem is it is always doing full table scan for fcst_budget, which is not what I am looking for.
    the inline subquery output is only 80 records with unique ci and facility and the desired execution plan will be using inline
    subquery as driving table to nested loop join the fcst_budget table, the pk for fcst_budget should be used.
    Somehow, this just does not happen.
    I tried to create a intermediate temp table to stage teh inline subquery result, and the result is good.
    DROP TABLE aaa
    CREATE TABLE aaa
    AS
    SELECT *
    FROM fcst_root_facility_all
    WHERE salesman IN (200)
    SELECT *
    FROM fcst_budget a,
    aaa b
    WHERE a.ci=b.ci AND a.facility=b.facility
    Plan
    SELECT STATEMENT ALL_ROWSCost: 193 Bytes: 937,890 Cardinality: 102
    4 NESTED LOOPS Cost: 193 Bytes: 937,890 Cardinality: 102
    1 TABLE ACCESS FULL TABLE SALES.AAA Cost: 4 Bytes: 720,960 Cardinality: 80
    3 TABLE ACCESS BY INDEX ROWID TABLE SALES.FCST_BUDGET Cost: 3 Bytes: 183 Cardinality: 1
    2 INDEX RANGE SCAN INDEX (UNIQUE) SALES.FCST_BUDGET_PK Cost: 2 Cardinality: 1
    comparing two plans, you can see the first plan step1, the cardinality=515, which is actually should be 80 in this case.
    Any body can help me tune this query to make Oracle optimizer pickup the correct plan?
    I do not like the temp table solution case it decreases the scalability.
    thanks

    SamB:
    Neither the /*+ cardinality (c 80) */ nor the USE_NL works.
    I also regenerated historgrams, that did not help either.
    Oracle is so persistent to use its own decision no matter what I tell it to do.
    The amazing thing I found today after tried your hint is:
    I re-analyze the fcst_root_facility_all table using DBMS_STATS.GATHER_TABLE_STATS
    function, and magically, it worked.
    I used to use analyze command to analyze table, seems there is some important accuracy difference between the two.
    although still can not understand why some many hint does not work, I am OK for now.
    thanks

  • Procedure is taking more time for execution

    hi,
    when i am trying to execute the below procedure it is taking more time for
    execution.
    can you pls suggest the possaible ways to tune the query.
    PROCEDURE sp_sel_cntr_ri_fact (
    po_cntr_ri_fact_cursor OUT t_cursor
    IS
    BEGIN
    OPEN po_cntr_ri_fact_cursor FOR
    SELET c_RI_fAt_id, c_RI_fAt_code,c_RI_fAt_nme,
         case when exists (SELET 'x' FROM A_CRF_PARAM_CALIB t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
         then 'Yes'
                   when exists (SELET 'x' FROM A_EMPI_ERV_CALIB_DETAIL t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM A_IC_CNTRY_IC_CRF_MPG_DTL t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM A_IC_CRF_CNTRYIDX_MPG_DTL t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM A_IC_CRF_RESI_COR t WHERE t.x_axis_c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM A_IC_CRF_RESI_COR t WHERE t.y_axis_c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM A_PAR_MARO_GAMMA_PRIME_CALIB t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM D_ANALYSIS_FAT t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM D_CALIB_CNTRY_RI_FATOR t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM E_BUSI_PORT_DTL t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM E_CNTRY_LOSS_DIST_RSLT t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM E_CNTRY_LOSS_RSLT t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM E_CRF_BUS_PORTFOL_CRITERIA t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM E_CRF_CORR_RSLT t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
                   when exists (SELET 'x' FROM E_HYPO_PORTF_DTL t WHERE t.c_RI_fAt_id = A_IC_CNTR_RI_FAT.c_RI_fAt_id)
                   then 'Yes'
              else
                   'No'
         end used_analysis_ind,
         creation_date, datetime_stamp, user_id
         FROM A_IC_CNTR_RI_FAT
    ORDER BY c_RI_fAt_id_nme DESC;
    END sp_sel_cntr_ri_fact;

    [When your query takes too long...|http://forums.oracle.com/forums/thread.jspa?messageID=1812597]

  • 30EA4 Problem using MySql: "Query execution was interrupted"

    Any query executes the first time but a second execution always causes the error "Query execution was interrupted"
    (Update: I just installed the prodcution release of sql delveloper 2.1.1.64.45 and have the same issue)
    I am using MySql driver 5.1.15
    Others seem to have a similar issue and I tries the older JDBC drivers but the 5.0.4 cause the connection to hang and the 5.0.8 caused the same problem "Query execution was interrupted"
    Vendor Code 1317 Query execution was interrupted MySQL
    I am using Windows7 64 bit (sql developer and jdk are 32 bit), see below
    MySql version
    -------------------------------------------------------+
    | Variable_name | Value |
    -------------------------------------------------------+
    | innodb_version | 1.1.4 |
    | protocol_version | 10 |
    | slave_type_conversions | |
    | version | 5.5.8 |
    | version_comment | MySQL Community Server (GPL) |
    | version_compile_machine | x86 |
    | version_compile_os | Win64 |
    -------------------------------------------------------+
    SQL Develper Info:
    About
    Oracle SQL Developer 3.0.03
    Version 3.0.03
    Build MAIN-03.97
    Copyright © 2005, 2011 Oracle. All Rights Reserved.
    IDE Version: 11.1.1.4.37.59.36
    Product ID: oracle.sqldeveloper
    Product Version: 11.1.2.03.97
    Version
    Component     Version
    =========     =======
    Java(TM) Platform     1.6.0_24
    Oracle IDE     3.0.03.97
    Versioning Support     3.0.03.97
    Properties
    Name     Value
    ====     =====
    awt.toolkit     sun.awt.windows.WToolkit
    class.load.environment     oracle.ide.boot.IdeClassLoadEnvironment
    class.load.log.level     CONFIG
    class.transfer     delegate
    file.encoding     Cp1252
    file.encoding.pkg     sun.io
    file.separator     \
    http.agent     Mozilla/5.0 (Java 1.6.0_24; Windows 7 6.1 x86; en_IE) ICEbrowser/v6_1_3
    ice.browser.forcegc     false
    ice.pilots.html4.ignoreNonGenericFonts     true
    ice.pilots.html4.tileOptThreshold     0
    ide.AssertTracingDisabled     true
    ide.bootstrap.start     7381246437329
    ide.build     MAIN-03.97
    ide.conf     C:\Program Files (x86)\sqldeveloper\sqldeveloper\bin\sqldeveloper.conf
    ide.config_pathname     C:\Program Files (x86)\sqldeveloper\sqldeveloper\bin\sqldeveloper.conf
    ide.debugbuild     false
    ide.devbuild     false
    ide.extension.search.path     sqldeveloper/extensions:jdev/extensions:ide/extensions
    ide.firstrun     true
    ide.java.minversion     1.6.0_04
    ide.launcherProcessId     2204
    ide.main.class     oracle.ide.boot.IdeLauncher
    ide.patches.dir     ide/lib/patches
    ide.pref.dir     C:\Users\mark\AppData\Roaming\SQL Developer
    ide.pref.dir.base     C:\Users\mark\AppData\Roaming
    ide.product     oracle.sqldeveloper
    ide.shell.enableFileTypeAssociation     C:\Program Files (x86)\sqldeveloper\sqldeveloper.exe
    ide.splash.screen     splash.gif
    ide.startingArg0     C:\Program Files (x86)\sqldeveloper\sqldeveloper.exe
    ide.startingcwd     C:\Program Files (x86)\sqldeveloper
    ide.user.dir     C:\Users\mark\AppData\Roaming\SQL Developer
    ide.user.dir.var     IDE_USER_DIR
    ide.vcs.noapplications     true
    ide.work.dir     C:\Users\mark\Documents\SQL Developer
    ide.work.dir.base     C:\Users\mark\Documents
    ilog.propagatesPropertyEditors     false
    java.awt.graphicsenv     sun.awt.Win32GraphicsEnvironment
    java.awt.printerjob     sun.awt.windows.WPrinterJob
    java.class.path     ..\..\ide\lib\ide-boot.jar
    java.class.version     50.0
    java.endorsed.dirs     C:\Program Files (x86)\Java\jdk1.6.0_24\jre\lib\endorsed
    java.ext.dirs     C:\Program Files (x86)\Java\jdk1.6.0_24\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
    java.home     C:\Program Files (x86)\Java\jdk1.6.0_24\jre
    java.io.tmpdir     C:\Users\mark\AppData\Local\Temp\
    java.library.path     C:\Program Files (x86)\sqldeveloper;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files\TortoiseSVN\bin;C:\Program Files\SlikSvn\bin\;C:\Program Files (x86)\Java\jdk1.6.0_24\bin;C:\Program Files (x86)\OpenVPN\bin;C:\tools\apache-maven-3.0.2\bin;C:\tools\mysql-5.5.8-winx64\bin
    java.naming.factory.initial     oracle.javatools.jndi.LocalInitialContextFactory
    java.protocol.handler.pkgs     oracle.jdevimpl.handler
    java.runtime.name     Java(TM) SE Runtime Environment
    java.runtime.version     1.6.0_24-b07
    java.specification.name     Java Platform API Specification
    java.specification.vendor     Sun Microsystems Inc.
    java.specification.version     1.6
    java.util.logging.config.file     logging.conf
    java.vendor     Sun Microsystems Inc.
    java.vendor.url     http://java.sun.com/
    java.vendor.url.bug     http://java.sun.com/cgi-bin/bugreport.cgi
    java.version     1.6.0_24
    java.vm.info     mixed mode
    java.vm.name     Java HotSpot(TM) Client VM
    java.vm.specification.name     Java Virtual Machine Specification
    java.vm.specification.vendor     Sun Microsystems Inc.
    java.vm.specification.version     1.0
    java.vm.vendor     Sun Microsystems Inc.
    java.vm.version     19.1-b02
    jdbc.library     /C:/Program Files (x86)/sqldeveloper/jdbc/lib/ojdbc6.jar
    line.separator     \r\n
    log.file.name     ..//log/datamodeler.log
    oracle.home     C:\Program Files (x86)\sqldeveloper
    oracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG     true
    oracle.jdbc.mapDateToTimestamp     false
    oracle.translated.locales     de,es,fr,it,ja,ko,pt_BR,zh_CN,zh_TW
    oracle.xdkjava.compatibility.version     9.0.4
    orai18n.library     /C:/Program Files (x86)/sqldeveloper/jlib/orai18n.jar
    os.arch     x86
    os.name     Windows 7
    os.version     6.1
    path.separator     ;
    reserved_filenames     con,aux,prn,lpt1,lpt2,lpt3,lpt4,lpt5,lpt6,lpt7,lpt8,lpt9,com1,com2,com3,com4,com5,com6,com7,com8,com9,conin$,conout,conout$
    sqldev.debug     false
    sun.arch.data.model     32
    sun.boot.class.path     C:\Program Files (x86)\Java\jdk1.6.0_24\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.6.0_24\jre\lib\rt.jar;C:\Program Files (x86)\Java\jdk1.6.0_24\jre\lib\sunrsasign.jar;C:\Program Files (x86)\Java\jdk1.6.0_24\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.6.0_24\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.6.0_24\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.6.0_24\jre\lib\modules\jdk.boot.jar;C:\Program Files (x86)\Java\jdk1.6.0_24\jre\classes
    sun.boot.library.path     C:\Program Files (x86)\Java\jdk1.6.0_24\jre\bin
    sun.cpu.endian     little
    sun.cpu.isalist     pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
    sun.desktop     windows
    sun.io.unicode.encoding     UnicodeLittle
    sun.java2d.ddoffscreen     false
    sun.jnu.encoding     Cp1252
    sun.management.compiler     HotSpot Client Compiler
    sun.os.patch.level     
    svnkit.sax.useDefault     true
    user.country     IE
    user.dir     C:\Program Files (x86)\sqldeveloper\sqldeveloper\bin
    user.home     C:\Users\mark
    user.language     en
    user.name     mark
    user.timezone     Europe/Paris
    user.variant     
    windows.shell.font.languages     
    Extensions
    Name     Identifier     Version     Status
    ====     ==========     =======     ======
    Check For Updates     oracle.ide.webupdate     11.1.1.4.37.59.36     Loaded
    Code Editor     oracle.ide.ceditor     11.1.1.4.37.59.36     Loaded
    Component Palette     oracle.ide.palette1     11.1.1.4.37.59.36     Loaded
    Data Miner     oracle.dmt.dataminer     11.2.0.1.9.96     Loaded
    Database Connection Support     oracle.jdeveloper.db.connection     11.1.1.4.37.59.36     Loaded
    Database Object Explorers     oracle.ide.db.explorer     11.1.1.4.37.59.36     Loaded
    Database UI     oracle.ide.db     11.1.1.4.37.59.36     Loaded
    Diagram Framework     oracle.diagram     11.1.1.4.37.59.36     Loaded
    Diagram Javadoc Extension     oracle.diagram.javadoc     11.1.1.4.37.59.36     Loaded
    Diagram Thumbnail     oracle.diagram.thumbnail     11.1.1.4.37.59.36     Loaded
    Diff/Merge     oracle.ide.diffmerge     11.1.1.4.37.59.36     Loaded
    Extended IDE Platform     oracle.javacore     11.1.1.4.37.59.36     Loaded
    External Tools     oracle.ide.externaltools     11.1.1.4.37.59.36     Loaded
    File Support     oracle.ide.files     11.1.1.4.37.59.36     Loaded
    Help System     oracle.ide.help     11.1.1.4.37.59.36     Loaded
    History Support     oracle.jdeveloper.history     11.1.1.4.37.59.36     Loaded
    Import/Export Support     oracle.ide.importexport     11.1.1.4.37.59.36     Loaded
    Index Migrator support     oracle.ideimpl.indexing-migrator     11.1.1.4.37.59.36     Loaded
    JDeveloper Runner     oracle.jdeveloper.runner     11.1.1.4.37.59.36     Loaded
    JViews Registration Addin     oracle.diagram.registration     11.1.1.4.37.59.36     Loaded
    Log Window     oracle.ide.log     11.1.1.4.37.59.36     Loaded
    Mac OS X Adapter     oracle.ideimpl.apple     11.1.1.4.37.59.36     Loaded
    Navigator     oracle.ide.navigator     11.1.1.4.37.59.36     Loaded
    Object Gallery     oracle.ide.gallery     11.1.1.4.37.59.36     Loaded
    Oracle IDE     oracle.ide     11.1.1.4.37.59.36     Loaded
    Oracle SQL Developer     oracle.sqldeveloper     11.1.2.03.97     Loaded
    Oracle SQL Developer - 3rd Party Database Browsers     oracle.sqldeveloper.thirdparty.browsers     11.1.1.03.97     Loaded
    Oracle SQL Developer - DBA Navigator     oracle.sqldeveloper.dbanavigator     11.1.1.03.97     Loaded
    Oracle SQL Developer - Extras     oracle.sqldeveloper.extras     1.1.1.03.97     Loaded
    Oracle SQL Developer - File Navigator     oracle.sqldeveloper.filenavigator     11.1.1.03.97     Loaded
    Oracle SQL Developer - Migrations Antlr3 Translator     oracle.sqldeveloper.migration.translation.core_antlr3     11.1.1.03.97     Loaded
    Oracle SQL Developer - Migrations Application Migration     oracle.sqldeveloper.migration.application     11.1.1.03.97     Loaded
    Oracle SQL Developer - Migrations Core     oracle.sqldeveloper.migration     11.1.1.03.97     Loaded
    Oracle SQL Developer - Migrations DB2     oracle.sqldeveloper.migration.db2     11.1.1.03.97     Loaded
    Oracle SQL Developer - Migrations DB2 Translator     oracle.sqldeveloper.migration.translation.db2     11.1.1.03.97     Loaded
    Oracle SQL Developer - Migrations Microsoft Access     oracle.sqldeveloper.migration.msaccess     11.1.1.03.97     Loaded
    Oracle SQL Developer - Migrations Microsoft SQL Server     oracle.sqldeveloper.migration.sqlserver     11.1.1.03.97     Loaded
    Oracle SQL Developer - Migrations MySQL     oracle.sqldeveloper.migration.mysql     11.1.1.03.97     Loaded
    Oracle SQL Developer - Migrations Sybase Adaptive Server     oracle.sqldeveloper.migration.sybase     11.1.1.03.97     Loaded
    Oracle SQL Developer - Migrations T-SQL Translator     oracle.sqldeveloper.migration.translation.core     11.1.1.03.97     Loaded
    Oracle SQL Developer - Migrations Teradata     oracle.sqldeveloper.migration.teradata     11.1.1.03.97     Loaded
    Oracle SQL Developer - Migrations Translation UI     oracle.sqldeveloper.migration.translation.gui     11.1.1.03.97     Loaded
    Oracle SQL Developer - Object Viewer     oracle.sqldeveloper.oviewer     11.1.1.03.97     Loaded
    Oracle SQL Developer - Real Time SQL Monitoring     oracle.sqldeveloper.sqlmonitor     11.1.1.03.97     Loaded
    Oracle SQL Developer - Reports     oracle.sqldeveloper.report     11.1.1.03.97     Loaded
    Oracle SQL Developer - Scheduler     oracle.sqldeveloper.scheduler     11.1.1.03.97     Loaded
    Oracle SQL Developer - Schema Browser     oracle.sqldeveloper.schemabrowser     11.1.1.03.97     Loaded
    Oracle SQL Developer - SearchBar     oracle.sqldeveloper.searchbar     11.1.1.03.97     Loaded
    Oracle SQL Developer - Snippet     oracle.sqldeveloper.snippet     11.1.1.03.97     Loaded
    Oracle SQL Developer - Spatial     oracle.sqldeveloper.spatial     11.1.1.03.97     Loaded
    Oracle SQL Developer - TimesTen     oracle.sqldeveloper.timesten     2.0.0.03.97     Loaded
    Oracle SQL Developer - Tuning     oracle.sqldeveloper.tuning     11.1.1.03.97     Loaded
    Oracle SQL Developer - Unit Test     oracle.sqldeveloper.unit_test     11.1.1.03.97     Loaded
    Oracle SQL Developer - User Extensions Support     oracle.sqldeveloper.userextensions     11.1.1.03.97     Loaded
    Oracle SQL Developer - Worksheet v2     oracle.sqldeveloper.worksheet     11.1.1.03.97     Loaded
    Oracle SQL Developer - XML Schema     oracle.sqldeveloper.xmlschema     11.1.1.03.97     Loaded
    Oracle SQL Developer Data Modeler     oracle.datamodeler     3.0.0.665     Loaded
    Oracle SQL Developer Data Modeler - Reports     oracle.sqldeveloper.datamodeler_reports     11.1.1.03.97     Loaded
    PROBE Debugger     oracle.jdeveloper.db.debug.probe     11.1.1.4.37.59.36     Loaded
    Peek     oracle.ide.peek     11.1.1.4.37.59.36     Loaded
    Persistent Storage     oracle.ide.persistence     11.1.1.4.37.59.36     Loaded
    Property Inspector     oracle.ide.inspector     11.1.1.4.37.59.36     Loaded
    QuickDiff     oracle.ide.quickdiff     11.1.1.4.37.59.36     Loaded
    Replace With     oracle.ide.replace     11.1.1.4.37.59.36     Loaded
    Runner     oracle.ide.runner     11.1.1.4.37.59.36     Loaded
    VHV     oracle.ide.vhv     11.1.1.4.37.59.36     Loaded
    Versioning Support     oracle.jdeveloper.vcs     11.1.1.4.37.59.36     Loaded
    Versioning Support for Subversion     oracle.jdeveloper.subversion     11.1.1.4.37.59.36     Loaded
    Virtual File System     oracle.ide.vfs     11.1.1.4.37.59.36     Loaded
    Web Browser and Proxy     oracle.ide.webbrowser     11.1.1.4.37.59.36     Loaded
    XML Editing Framework IDE Extension     oracle.ide.xmlef     11.1.1.4.37.59.36     Loaded
    audit     oracle.ide.audit     11.1.1.4.37.59.36     Loaded
    classpath: protocol handler extension     oracle.jdeveloper.classpath     11.1.1.0.0     Loaded
    jdukshare     oracle.bm.jdukshare     11.1.1.4.37.59.36     Loaded
    mof-xmi     oracle.mof.xmi     11.1.1.4.37.59.36     Loaded
    oracle.ide.dependency     oracle.ide.dependency     11.1.1.4.37.59.36     Loaded
    oracle.ide.indexing     oracle.ide.indexing     11.1.1.4.37.59.36     Loaded
    palette2     oracle.ide.palette2     11.1.1.4.37.59.36     Loaded
    status     oracle.ide.status     11.1.1.4.37.59.36     Loaded
    Edited by: user501466 on 19-Mar-2011 03:21

    Hi Dermot,
    Some clarification.
    I have tried these 3 drivers below with the following results:
    5.0.4 First Query succeeds, Second gives error "Unknown prepared statement handler (131072) given to mysqld_stmt_execute". At this point I can exit SQL Developer. If I run it a third time then the query does not complete and any attempt to exit SQL Developer results in "Connection is currently busy, try again?" and ultimately I have to kill it.
    5.0.8 First Query succeeds, Second Query fails with Query execution was interrupted. Subsequent queries give the same result.
    5.1.15 Same as 5.0.8
    I tried your suggestion, removed the driver, restarted, installed the 5.0.4 driver and restated and ran the test,
    (I added a drop table so I could run it repeatedly) and it works repeatedly if I choose "Run as script F5".
    DROP TABLE table1;
    CREATE TABLE table1(col1 int);
    INSERT INTO Table1 values(1);
    SELECT * FROM table1;
    SELECT * FROM table1;
    But If I execute the query "select * from table1" using "Run Statement Ctrl-Enter" twice then I get problem behaviour as described above.
    I looked in the logfile for SQLDeveloper but it was empty.
    I also tried creating a new database as root and connecting as root (same result)
    I also tried the NightlyBuild of 5.1 and 6.0 but gave the same result as 5.1.5.
    I have two other tools for accessing MySql: Toad and MySql workbench, both of which work but I've used SQL Developer with Oracle for some years and would like to keep using it.
    I just tried connecting to a remote MySQL database and that seems to work without problems.
    I'm thinking it may be related to some incompatibility between SQLDeveloper and the MySQL installed locally.
    I'll try another version....
    Ok I installed a 32 bit version of MySql 5.5.10. I thought things were working but now I still get the problem but it is much more intermittent.
    Now I can get it by modifying the query ie.
    select * from table1; (works repeatedly untill followed by a change to the query)
    select * from table1 order by col1; (fails)
    Another case
    select * from table1 order by col1; (works repeatedly)
    select * from table1 order by col1 asc; (fails first time)
    very weird...
    Edited by: user501466 on 26-Mar-2011 06:19

  • Can Oracle make mistakes while making execution plan?

    Env: Running Oracle DB 11g Rel 1.
    Is it possible that oracle may use a different execution plan for the same query depending on the environment where its running due to any reason. I am running an oracle report 6i/10g which has started to take too long to run but at the same time runs better/faster while in sql*plus or toad. Report has nothing more than a query (like: no pl/sql, or triggers with sqls).
    Is it also possible that depending on the different environment that runs the query or user profile, oracle might be using a different (may be bad) execution plan. Though at the same time database is same, no parameters are changed at run time explicitly by user or application. Base table of the query are all analyzed on regular basis.
    Or, is it possible that at some point in time in the past, the same query had a bad plan and oracle kept using it from the cache (though I can't find any doc which would support this). I think that estimated plan might be bad based on past statistics but actual plan shouldn't be same bad as estimated. Does clearing the cache help?
    Any insight or links to docs are appreciated.

    ocp9i wrote:
    Env: Running Oracle DB 11g Rel 1.
    Is it possible that oracle may use a different execution plan for the same query depending on the environment where its running due to any reason. That is after all what cost based optimisation is.. taking the existing factors into consideration for determining the execution plans. Different factors may apply for future executions of that SQL - which could mean a different execution plan.
    CBO does not mean that there will be a consistent-always-the-same execution plan for a SQL. It can and often will differ over time.
    I am running an oracle report 6i/10g which has started to take too long to run but at the same time runs better/faster while in sql*plus or toad.You cannot evaluate performance using elapsed execution time - that is a flawed approach. The very same query can run a lot faster after the 1st execution as the 1st execution did expensive physical I/O from disk. Subsequent execution of that query will find the data in the buffer cache and instead of physical I/O, do cheaper logical I/O.
    Also, reporting will typically include rendering. This is an added overhead that a plain SQL select in comparison will not have.
    So you need to be careful in how you match the performance of a query like this. There's a lot more to it than meets the eye.
    Or, is it possible that at some point in time in the past, the same query had a bad plan and oracle kept using it from the cache (though I can't find any doc which would support this). How do you know that this is a bad execution plan? How do you know that the report SQL uses a different execution plan than what your plain SQL select test does?
    If the query is exactly the same (proper shared SQL), then there will be a single execution plan for that query. The 1st time that the query is hard parsed, this execution plan is created. Subsequent processes/sessions will use the very same execution plan (soft parsing) until that cursor is aged from the Shared Pool.
    Thus if you are firing off an identical query via Reports and something like SQL*Plus.. chances are excellent that both is using the exact same execution plan.
    Any insight or links to docs are appreciated.Suggest that you look at the Oracle Concepts guide. You'll find it via http://tahiti.oracle.com

  • Invisible index getting accessed during query execution

    Hello Guys,
    There is a strange problem , I am encountering . I am working on tuning the performance of one of the concurrent request in our 11i ERP System having database 11.1.0.7
    I had enabled oradebug trace for the request and generated tkprof out of it. For below query which is taking time , I found that , in the trace generated , wait event is "db file sequential read" on an PO_LINES_N10 index but in the generated tkprof , for the same below query , the full table scan for PO_LINES_ALL is happening , as that table is 600 MB in size.
    Below is the query ,
    ===============
    UPDATE PO_LINES_ALL A
    SET A.VENDOR_PRODUCT_NUM = (SELECT SUPPLIER_ITEM FROM APPS.IRPO_IN_BPAUPDATE_TMP C WHERE BATCH_ID = :B1 AND PROCESSED_FLAG = 'P' AND ACTION = 'UPDATE' AND C.LINE_ID =A.PO_LINE_ID AND ROWNUM = 1 AND SUPPLIER_ITEM IS NOT NULL),
    LAST_UPDATE_DATE = SYSDATE
    ===============
    Index PO_LINES_N10 is on the column LAST_UPDATE_DATE , logically for such query , index should not have got used as that indexed column is not in select / where clause.
    Also, why there is discrepancy between tkprof and trace generated for the same query .
    So , I decided to INVISIBLE the index PO_LINES_N10 but still that index is getting accessed in the trace file .
    I have also checked the below parameter , which is false so optimizer should not make use of invisible indexes during query execution.
    SQL> show parameter invisible
    NAME TYPE VALUE
    optimizer_use_invisible_indexes boolean FALSE
    Any clue regarding this .
    Thanks and Regards,
    Prasad
    Edited by: Prasad on Jun 15, 2011 4:39 AM

    Hi Dom,
    Sorry for the late reply , but yes , an update statement is trying to update that index even if it's invisible.
    Also, it seems performance issue started appearing when this index got created , so now I have dropped that index in test environment and ran the concurrent program again with oradebug level 12 trace enabled and found bit improvement in the results .
    With index dropped -> 24 records/min got processed
    With index -> 14 records/min got processed
    so , I am looking forward without this index in the production too but before that, I have concerns regarding tkprof output. Can we further improve the performance of this query.
    Please find the below tkprof with and without index .
    ====================
    Sql statement
    ====================
    UPDATE PO_LINES_ALL A SET A.VENDOR_PRODUCT_NUM = (SELECT SUPPLIER_ITEM FROM
    APPS.IRPO_IN_BPAUPDATE_TMP C
    WHERE
    BATCH_ID = :B1 AND PROCESSED_FLAG = 'P' AND ACTION = 'UPDATE' AND C.LINE_ID =
    A.PO_LINE_ID AND ROWNUM = 1 AND SUPPLIER_ITEM IS NOT NULL),
    LAST_UPDATE_DATE = SYSDATE
    =========================
    TKPROF with Index for the above query ( processed 643 records )
    =========================
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 2499.64 2511.99 98158 645561632 13105579 1812777
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 2499.64 2511.99 98158 645561632 13105579 1812777
    =============================
    TKPROF without Index for the above query ( processed 4452 records )
    =============================
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 10746.96 10544.13 84125 3079376156 1870058 1816289
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 10746.96 10544.13 84125 3079376156 1870058 1816289
    =============================
    Explain plan which is same in both the cases
    =============================
    Rows Row Source Operation
    0 UPDATE PO_LINES_ALL (cr=3079377095 pr=84127 pw=0 time=0 us)
    1816289 TABLE ACCESS FULL PO_LINES_ALL (cr=83175 pr=83026 pw=0 time=117690 us cost=11151 size=29060624 card=1816289)
    0 COUNT STOPKEY (cr=3079292918 pr=20 pw=0 time=0 us)
    0 TABLE ACCESS BY INDEX ROWID IRPO_IN_BPAUPDATE_TMP (cr=3079292918 pr=20 pw=0 time=0 us cost=4 size=22 card=1)
    180368800 INDEX RANGE SCAN IRPO_IN_BPAUPDATE_N1 (cr=51539155 pr=3 pw=0 time=16090005 us cost=3 size=0 card=1)(object id 372721)
    There is a lot increase in the CPU ,so I would like to further tune this query. I have run SQL Tuning task but didn't get any recommendations for the same.
    Since in the trace , I have got db scattered read wait event for the table "PO_LINES_ALL" but disk reads are not much , so am not sure the performance improvement even if I pin this table (620 MB in size and is it feasible to pin , SGA is 5GB with sga_target set ) in the shared pool .
    I have already gathers stats for the concerned tables and rebuilt the indexes .
    Is there any other thing that can be performed to tune this query further and bring down CPU, time taken to execute.
    Thanks a lot for your reply.
    Thanks and Regards,
    Prasad
    Edited by: Prasad on Jun 28, 2011 3:52 AM
    Edited by: Prasad on Jun 28, 2011 3:54 AM
    Edited by: Prasad on Jun 28, 2011 3:56 AM

  • Query execution time

    Dear SCN,
    I am new to BOBJ Environment. I have created a webi report on top of bex query by using BISC connection. Bex query is build for Vendor Ageing Analysis. My bex query will take very less time to execute the report (max 1 min). But in case of webi is takeing around 5 min when i click on refresh. I have not used any conditions,filters,restrictions are done at webi level all are done at bex level only.
    Please let me know techniques to optimize the query execution time in webi. Currently we are in BO 4.0.
    Regards,
    PRK

    Hi Praveen
    Go through this document for performance optimization using BICS connection
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0e3c552-e419-3010-1298-b32e6210b58d?QuickLink=index&…

  • An error has occurred during report processing. (rsProcessingAborted).. Query execution failed for data set

    Hi All,
    I'm facing a strange problem..
    I've developed few reports. they are working fine in develop environment. after successfull testing they were published on web.
    in web version, all reports are executing for first time.. if I change any of parameters values or without chaning also..
    if I press "View Report"  following error occurs..
    An error has occurred during report processing. (rsProcessingAborted)
    Query execution failed for data set 'dsMLGDB2Odbc'. (rsErrorExecutingCommand)
    For more information about this error navigate to the report server on the local server machine, or enable remote errors
    please suggest any alternative ways to overcome this issue
    thanks in adv.

    in my case the problem is
    one virtual machine is for developers
    other for testers
    in developers i created a report, then save like *.rdl and copy to testers machine, does not work there
    the error what testers get is
    Error during the local report processing.
    Could not find a web-based application at http://developersMachine/AnalyticsReports/DataBaseConnector.rsds
    and the solution is to use alternative url or in some cases http://localhost/

  • Finding number of working days during query execution

    Hi ,
    We have a requirement to calculate number of working days during query execution. In the cube we got "received date", this will be used as a variable in the query. Based on the received date value entered, query needs to display number of products received from past 1, 2,3,4 days (working days should include weekends or public holidays).
    1day     2 days     3 days     4 days   5 days 
    10         12            20            15          20
    to me it appears as I need to create virtual key figures.
    Regards,
    Ramz

    Hi ramesh,
    First try to create formula variables for start data and end date to calculate the no of working days.
    Create a Variable ZSTDT --of type replacement path.
    Type of Variable = Formula
    Variable Name = ZSTDT
    Characteristic = <info object>
    For Intervals Use = Select From Value
    Offset Start = 0000 Offset Length = 0000
    Replacement var with : key
    use the same steps to create one more formula variable to get end date.
    Now create a formula to get the No of days.
    once after getting no of days you can create buckets as per your need.
    for more info check the below links
    http://www.sd-solutions.com/SAP-HCM-BW-Replacement-Path-Variables.html
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30f15839-0cf1-2b10-c6a7-ebe68cc87cdc?quicklink=index&overridelayout=true

Maybe you are looking for