Help for query tuning

hello all
my one of query is returning result in 1-2 mins only for 1 lakh record but i am not sure if it showed me complete rows or not because when I an trying to get count of result ..its taking lot of time .when I am using this query on plsql code ..code is running slow so just wanted to confirm on query tuning point of view if its fine or not ..please look onto it and let me know if query is fine or not by explain plan .my oracle version is 11g
this is my query
SELECT ROWNUM , TRUNC(rownum/5000) + 20000 ,'FOR_UPDATE', sku_org.NAME ,
acct_promo_sku.src_num , acct_promo_sku.sub_type ,
promo_actual.sku_actual_pos
FROM siebel.s_src acct_promo_hdr,
siebel.s_src acct_title_format,
siebel.s_src acct_promo_sku,
siebel.s_src_x acct_promo_hdrx,
siebel.s_src_x acct_promo_skux,
siebel.s_prod_int prod,
siebel.s_bu promo_hdr_org,
siebel.s_bu sku_org,
siebelwb.stg_sbl_acct_promo_actuals2 promo_actual
WHERE acct_promo_hdr.sub_type = 'PLAN_ACCOUNT_PROMOTION'
AND acct_promo_hdr.row_id = acct_title_format.par_src_id
AND acct_title_format.sub_type = 'PLAN_ACCT_PROMOTION_CATEGORY'
AND acct_title_format.row_id = acct_promo_sku.par_src_id
AND acct_promo_sku.sub_type = 'PLAN_ACCOUNT_PROMOTION_PRODUCT'
AND acct_promo_hdr.row_id = acct_promo_hdrx.par_row_id
AND acct_promo_sku.row_id = acct_promo_skux.par_row_id(+)
AND acct_promo_sku.prod_id = prod.row_id
AND acct_promo_hdr.bu_id = promo_hdr_org.row_id
AND acct_promo_sku.bu_id = sku_org.row_id
AND prod.x_prod_material_num = promo_actual.material_number
and prod.X_PROD_SALES_ORG=promo_actual.sales_org
AND acct_promo_hdr.row_id = promo_actual.acct_promo_id
and nvl(acct_promo_hdr.pr_accnt_id,0)=nvl(promo_actual.acct_siebel_rowid,0)
and nvl(acct_promo_hdr.x_indirect_id,0)=nvl(promo_actual.indirect_acct_siebel_rowid,0)
AND promo_actual.load_date >= TRUNC(SYSDATE)
AND promo_actual.load_date < TRUNC(SYSDATE + 1)
explain plan
PLAN_TABLE_OUTPUT
Plan hash value: 3864590768
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 298 | 2300 (1)| 00:00:28 |
| 1 | COUNT | | | | | |
|* 2 | FILTER | | | | | |
| 3 | NESTED LOOPS | | | | | |
| 4 | NESTED LOOPS | | 1 | 298 | 2300 (1)| 00:00:28 |
| 5 | NESTED LOOPS OUTER | | 1 | 273 | 2298 (1)| 00:00:28 |
| 6 | NESTED LOOPS | | 1 | 263 | 2296 (1)| 00:00:28 |
| 7 | NESTED LOOPS | | 1 | 236 | 2295 (1)| 00:00:28 |
| 8 | NESTED LOOPS | | 1 | 165 | 2292 (1)| 00:00:28 |
| 9 | NESTED LOOPS | | 1 | 117 | 2289 (1)| 00:00:28 |
| 10 | NESTED LOOPS | | 1 | 109 | 2289 (1)| 00:00:28 |
| 11 | NESTED LOOPS | | 1 | 99 | 2287 (1)| 00:00:28 |
|* 12 | TABLE ACCESS FULL | STG_SBL_ACCT_PROMO_ACTUALS2 | 1 | 49 | 2285 (1)| 00:0
|* 13 | TABLE ACCESS BY INDEX ROWID| S_SRC | 1 | 50 | 2 (0)| 00:00:01 |
|* 14 | INDEX UNIQUE SCAN | S_SRC_P1 | 1 | | 1 (0)| 00:00:01 |
|* 15 | INDEX RANGE SCAN | S_SRC_X_U1 | 1 | 10 | 2 (0)| 00:00:01 |
|* 16 | INDEX UNIQUE SCAN | S_BU_P1 | 1 | 8 | 0 (0)| 00:00:01 |
|* 17 | TABLE ACCESS BY INDEX ROWID | S_SRC | 1 | 48 | 3 (0)| 00:00:01 |
|* 18 | INDEX RANGE SCAN | S_SRC_F2 | 2 | | 2 (0)| 00:00:01 |
|* 19 | TABLE ACCESS BY INDEX ROWID | S_SRC | 1 | 71 | 3 (0)| 00:00:01 |
|* 20 | INDEX RANGE SCAN | S_SRC_F2 | 2 | | 2 (0)| 00:00:01 |
| 21 | TABLE ACCESS BY INDEX ROWID | S_BU | 1 | 27 | 1 (0)| 00:00:01 |
|* 22 | INDEX UNIQUE SCAN | S_BU_P1 | 1 | | 0 (0)| 00:00:01 |
|* 23 | INDEX RANGE SCAN | S_SRC_X_U1 | 1 | 10 | 2 (0)| 00:00:01 |
|* 24 | INDEX UNIQUE SCAN | S_PROD_INT_P1 | 1 | | 1 (0)| 00:00:01 |
|* 25 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 1 | 25 | 2 (0)| 00:00:
Predicate Information (identified by operation id):
2 - filter(TRUNC(SYSDATE@!)<TRUNC(SYSDATE@!+1))
12 - filter("PROMO_ACTUAL"."LOAD_DATE">=TRUNC(SYSDATE@!) AND "PROMO_ACTUAL"."LOAD_DATE"<TRUNC(SYSD
13 - filter("ACCT_PROMO_HDR"."SUB_TYPE"='PLAN_ACCOUNT_PROMOTION' AND
NVL("ACCT_PROMO_HDR"."PR_ACCNT_ID",'0')=NVL("PROMO_ACTUAL"."ACCT_SIEBEL_ROWID",'0') AND
NVL("ACCT_PROMO_HDR"."X_INDIRECT_ID",'0')=NVL("PROMO_ACTUAL"."INDIRECT_ACCT_SIEBEL_ROWID",'0'
14 - access("ACCT_PROMO_HDR"."ROW_ID"="PROMO_ACTUAL"."ACCT_PROMO_ID")
15 - access("ACCT_PROMO_HDR"."ROW_ID"="ACCT_PROMO_HDRX"."PAR_ROW_ID")
16 - access("ACCT_PROMO_HDR"."BU_ID"="PROMO_HDR_ORG"."ROW_ID")
17 - filter("ACCT_TITLE_FORMAT"."SUB_TYPE"='PLAN_ACCT_PROMOTION_CATEGORY')
18 - access("ACCT_PROMO_HDR"."ROW_ID"="ACCT_TITLE_FORMAT"."PAR_SRC_ID")
19 - filter("ACCT_PROMO_SKU"."PROD_ID" IS NOT NULL AND
"ACCT_PROMO_SKU"."SUB_TYPE"='PLAN_ACCOUNT_PROMOTION_PRODUCT')
20 - access("ACCT_TITLE_FORMAT"."ROW_ID"="ACCT_PROMO_SKU"."PAR_SRC_ID")
22 - access("ACCT_PROMO_SKU"."BU_ID"="SKU_ORG"."ROW_ID")
23 - access("ACCT_PROMO_SKU"."ROW_ID"="ACCT_PROMO_SKUX"."PAR_ROW_ID"(+))
24 - access("ACCT_PROMO_SKU"."PROD_ID"="PROD"."ROW_ID")
25 - filter("PROD"."X_PROD_MATERIAL_NUM" IS NOT NULL AND
"PROD"."X_PROD_MATERIAL_NUM"="PROMO_ACTUAL"."MATERIAL_NUMBER" AND
"PROD"."X_PROD_SALES_ORG"="PROMO_ACTUAL"."SALES_ORG")
55 rows selected.
thanks

Hi,
the plan you posted has the cost of 2300, i.e. 2300 single-block reads or equivalent number f multi-block reads. Even if none of the blocks is found in cache, 2300 reas shouldn't take more than a couple of minutes, beacause for most of the hard drives available today a disk read is typically within 5-10 ms.
This means that if there is a problem, we will never find out about it by looking in the plan. And it's quite likely that there is, in fact, a problem, because the plan contains a bunch of nested joins, and the cost of each nested join is directly proportional to the cardinality of the previous nested loop. I.e. it suffices to make one bad mistake in estimating the number of rows coming fom one of the nested rows to screw up the entire plan and get all remaining estimates (including the total cost of the query) completely wrong.
In order for us to be able to tell more, we need to see the plan with rowsource statistics, and please don't forget to use tags to preserve formatting (use the preview tab to make sure the posted plan is actually readable).
Best regards,
  Nikolay                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Need help in query tuning

    Hi All,
    In my application I have 3 tables. Event(1.2 L records), KeyWord(1K records) and Event_KeyWord_Mapping(1.4 L records) table.
    In my query i need to sort the Events table by 3 columns -( 1 Date column and 2 String column) and i am interested only in top 40 records.
    Below is the example query.
    select
        from
            (    select
                      a.*,
                ROWNUM    
            from
                (    select
                    distinct event_id   
                from
                    (     select
                        (this_.EVENT_ID),
                        this_.EVENT_GMT_DATE ,
                        this_.PRIORITY    
                    from
                        EVENTS this_,
                        event_keyword_mapping ekp 
                    where
                        this_.EVENT_ID = ekp.event_id
                        AND  ekp.keyword_id IN (
                            1643,2278,24,1090,2422,401 )
                        AND (
                                EVENT_CODE = 'IEP'
                                AND (
                                    IS_SCALL = 'Y'
                                    AND  COUNTRY_DISPLAY IN (
                                        'US','CA','UK','BE','FR','DE','IT','JP','AU','CH','EU'
                        OR (
                                EVENT_CODE = 'ICC'
                                AND IS_GTINDEX = 'Y'
                        AND  FX_EVENT = 'N' 
                        AND  EVENT_GMT_DATE BETWEEN to_date('12/27/2011 05:14:00','mm/dd/yyyy HH24:MI:SS')and
    to_date('03/27/2012 10:28:44','mm/dd/yyyy HH24:MI:SS')
                    ORDER BY
                        EVENT_GMT_DATE ASC  ,
                        PRIORITY ASC  ,
                        EVENT_ID ASC )) a 
                where
                    ROWNUM<=41)(1643,2278,24,1090,2422,401) keywords have 90K+ mappings.
    Below is the explain plan for the above query.
    | Id  | Operation                               | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |                                                                                                                                                                         
    |   0 | SELECT STATEMENT                        |                                |    41 |  1066 |       |   629K (85)| 02:05:51 |                                                                                                                                                                         
    |   1 |  VIEW                                   |                                |    41 |  1066 |       |   629K (85)| 02:05:51 |                                                                                                                                                                         
    |*  2 |   COUNT STOPKEY                         |                                |       |       |       |            |          |                                                                                                                                                                         
    |   3 |    VIEW                                 |                                | 25738 |   326K|       |   629K (85)| 02:05:51 |                                                                                                                                                                         
    |*  4 |     SORT GROUP BY STOPKEY               |                                | 25738 |   955K|  6929M|   629K  (2)| 02:05:51 |                                                                                                                                                                         
    |   5 |      CONCATENATION                      |                                |       |       |       |            |          |                                                                                                                                                                         
    |   6 |       MERGE JOIN CARTESIAN              |                                |   150M|  5463M|       | 96245   (2)| 00:19:15 |                                                                                                                                                                         
    |   7 |        TABLE ACCESS BY INDEX ROWID      | EVENTS                         |  1132 | 32828 |       |  1618   (1)| 00:00:20 |                                                                                                                                                                         
    |   8 |         BITMAP CONVERSION TO ROWIDS     |                                |       |       |       |            |          |                                                                                                                                                                         
    |   9 |          BITMAP AND                     |                                |       |       |       |            |          |                                                                                                                                                                         
    |  10 |           BITMAP CONVERSION FROM ROWIDS |                                |       |       |       |            |          |                                                                                                                                                                         
    |  11 |            SORT ORDER BY                |                                |       |       |       |            |          |                                                                                                                                                                         
    |* 12 |             INDEX RANGE SCAN            | EVT_PRIORITY_GMT_DATE_ID_INDEX | 30402 |       |       |    68   (0)| 00:00:01 |                                                                                                                                                                         
    |  13 |           BITMAP CONVERSION FROM ROWIDS |                                |       |       |       |            |          |                                                                                                                                                                         
    |* 14 |            INDEX RANGE SCAN             | EVENT_CODE_INDEX               | 30402 |       |       |    79   (0)| 00:00:01 |                                                                                                                                                                         
    |  15 |           BITMAP CONVERSION FROM ROWIDS |                                |       |       |       |            |          |                                                                                                                                                                         
    |* 16 |            INDEX RANGE SCAN             | FX_EVENT_INDEX                 | 30402 |       |       |   102   (1)| 00:00:02 |                                                                                                                                                                         
    |  17 |           BITMAP CONVERSION FROM ROWIDS |                                |       |       |       |            |          |                                                                                                                                                                         
    |* 18 |            INDEX RANGE SCAN             | IS_GTINDEX_INDEX               | 30402 |       |       |   102   (1)| 00:00:02 |                                                                                                                                                                         
    |  19 |        BUFFER SORT                      |                                |   133K|  1170K|       | 94627   (2)| 00:18:56 |                                                                                                                                                                         
    |  20 |         TABLE ACCESS FULL               | EVENT_KEYWORD_MAPPING          |   133K|  1170K|       |    84   (3)| 00:00:02 |                                                                                                                                                                         
    |* 21 |       HASH JOIN                         |                                |  6691 |   248K|       |  2489   (1)| 00:00:30 |                                                                                                                                                                         
    |* 22 |        TABLE ACCESS BY INDEX ROWID      | EVENTS                         |  1937 | 56173 |       |  2401   (1)| 00:00:29 |                                                                                                                                                                         
    |  23 |         BITMAP CONVERSION TO ROWIDS     |                                |       |       |       |            |          |                                                                                                                                                                         
    |  24 |          BITMAP AND                     |                                |       |       |       |            |          |                                                                                                                                                                         
    |  25 |           BITMAP OR                     |                                |       |       |       |            |          |                                                                                                                                                                         
    |  26 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 27 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  28 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 29 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  30 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 31 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  32 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 33 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  34 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 35 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  36 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 37 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  38 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 39 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  40 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 41 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  42 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 43 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  44 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 45 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  46 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 47 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  48 |           BITMAP CONVERSION FROM ROWIDS |                                |       |       |       |            |          |                                                                                                                                                                         
    |* 49 |            INDEX RANGE SCAN             | EVENT_CODE_INDEX               | 30402 |       |       |    79   (0)| 00:00:01 |                                                                                                                                                                         
    |  50 |           BITMAP CONVERSION FROM ROWIDS |                                |       |       |       |            |          |                                                                                                                                                                         
    |* 51 |            INDEX RANGE SCAN             | IS_SCALL_INDEX                 | 30402 |       |       |   100   (1)| 00:00:02 |                                                                                                                                                                         
    |* 52 |        TABLE ACCESS FULL                | EVENT_KEYWORD_MAPPING          | 88609 |   778K|       |    87   (4)| 00:00:02 |                                                                                                                                                                         
    Predicate Information (identified by operation id):                                                                                                                                                                                                                                                        
       2 - filter(ROWNUM<=41)                                                                                                                                                                                                                                                                                  
       4 - filter(ROWNUM<=41)                                                                                                                                                                                                                                                                                  
      12 - access("EVENT_GMT_DATE">=TO_DATE(' 2011-12-27 05:14:00', 'syyyy-mm-dd hh24:mi:ss') AND "EVENT_GMT_DATE"<=TO_DATE('                                                                                                                                                                                  
                  2012-03-27 10:28:44', 'syyyy-mm-dd hh24:mi:ss'))                                                                                                                                                                                                                                             
           filter("EVENT_GMT_DATE"<=TO_DATE(' 2012-03-27 10:28:44', 'syyyy-mm-dd hh24:mi:ss') AND "EVENT_GMT_DATE">=TO_DATE('                                                                                                                                                                                  
                  2011-12-27 05:14:00', 'syyyy-mm-dd hh24:mi:ss'))                                                                                                                                                                                                                                             
      14 - access("EVENT_CODE"='ICC')                                                                                                                                                                                                                                                                          
      16 - access("FX_EVENT"='N')                                                                                                                                                                                                                                                                              
      18 - access("IS_GTINDEX"='Y')                                                                                                                                                                                                                                                                            
      21 - access("THIS_"."EVENT_ID"="EKP"."EVENT_ID")                                                                                                                                                                                                                                                         
      22 - filter(LNNVL("EVENT_CODE"='ICC') OR LNNVL("IS_GTINDEX"='Y') OR LNNVL("FX_EVENT"='N') OR                                                                                                                                                                                                             
                  LNNVL("EVENT_GMT_DATE">=TO_DATE(' 2011-12-27 05:14:00', 'syyyy-mm-dd hh24:mi:ss')) OR LNNVL("EVENT_GMT_DATE"<=TO_DATE('                                                                                                                                                                      
                  2012-03-27 10:28:44', 'syyyy-mm-dd hh24:mi:ss')))                                                                                                                                                                                                                                            
      27 - access("COUNTRY_DISPLAY"='AU')                                                                                                                                                                                                                                                                      
      29 - access("COUNTRY_DISPLAY"='BE')                                                                                                                                                                                                                                                                      
      31 - access("COUNTRY_DISPLAY"='CA')                                                                                                                                                                                                                                                                      
      33 - access("COUNTRY_DISPLAY"='CH')                                                                                                                                                                                                                                                                      
      35 - access("COUNTRY_DISPLAY"='DE')                                                                                                                                                                                                                                                                      
      37 - access("COUNTRY_DISPLAY"='EU')                                                                                                                                                                                                                                                                      
      39 - access("COUNTRY_DISPLAY"='FR')                                                                                                                                                                                                                                                                      
      41 - access("COUNTRY_DISPLAY"='IT')                                                                                                                                                                                                                                                                      
      43 - access("COUNTRY_DISPLAY"='JP')                                                                                                                                                                                                                                                                      
      45 - access("COUNTRY_DISPLAY"='UK')                                                                                                                                                                                                                                                                      
      47 - access("COUNTRY_DISPLAY"='US')                                                                                                                                                                                                                                                                      
      49 - access("EVENT_CODE"='IEP')                                                                                                                                                                                                                                                                          
      51 - access("IS_SCALL"='Y')                                                                                                                                                                                                                                                                              
      52 - filter("EKP"."KEYWORD_ID"=24 OR "EKP"."KEYWORD_ID"=401 OR "EKP"."KEYWORD_ID"=1090 OR "EKP"."KEYWORD_ID"=1643 OR                                                                                                                                                                                     
                  "EKP"."KEYWORD_ID"=2278 OR "EKP"."KEYWORD_ID"=2422)                                                                                                                                                                                                                                           When the above query is executed its taking around 10 seconds to return the data.
    I am using- Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit
    I need help in bringing down the query execution time.
    Thanks,
    Girish G

    A few questions:
    1. Are any indexes available on the Event_KeyWord_Mapping table?
    2. What does '1.4 L records' mean? Not familiar with 'L'.
    3. Are the statistics up to date for the tables and indexes involved?
    4. Are EVENT_ID and KEYWORD_ID the only columns accessed from the Event_KeyWord_Mapping table?
    Assuming the above then DarkStargate's suggestion is on point.
    But you should add the KEYWORD_ID column to the index as well since that is what the index records are filtered on.
    AND  ekp.keyword_id IN (
                            1643,2278,24,1090,2422,401 )Be sure that index statistics are collected; they will provide Oracle with data about the distribution of KEYWORD_ID values.
    This will allow Oracle to get the required information from the index without accessing the Event_KeyWord_Mapping table itself.

  • Search Help for query

    Hi,
    I'm facing an issue related to the variable search help.
    I have a query which has been recently migrated to 7.0. When I open the query on Analyzer and look for values in a variable it is throwing me the relevent values for that particular variable itself, which is perfect.
    When I run the same query on portal, and look for variable input values, I'm getting all the master data entries along with the variable value. I do not want all these other master data entries.
    Please help.

    Hi,
    There are two possible read modes for the value help of variables:
    - Read mode "M" means "Values in master data table".
    - Read mode "D" means "Only values in InfoProvider".
    Please set related setting in infoobject level it should resolved your issue.
    Regards,
    Venkat

  • Application Help for Query Designer for Netweaver 2004S

    Does anyone know how to install the Help Files for the Business Explorer Tool for Netweaver 2004S?  When I click on the Help>>Applicaton Help from any of these tools, it states it can't find the files.  I have it setup and working within ABAP.
    Thanks,
    Jeff Cook

    The help dvd that came with upgrade explains how to setup for the ABAP side, not the Query Designer.  Do you know the parameter settings?  Does Query Designer help use the sapdoccd.ini file?
    Thanks ,
    Jeff

  • Need help for query... exam incoming...

    ARTIST(CodA,NameA)
    WORK(CodW,Title,AuthorCode,ExpositionCode)
    Question:
    For each ExpositionCode, find the artists with the greater number of exposed works
    Pls... help!!
    Fabio

    It's running, i have only to remove title
    italics with howmuch as
    italics(select ExpositionCode,AuthorCode,count(*) n from work
    italicsgroup by ExpositionCode,AuthorCode)
    italicsselect ExpositionCode,AuthorCode,n from howmuch h1,ARTIST a
    italicswhere h1.n=(select max(n) from howmuch h2 where h2.ExpositionCode=h1.ExpositionCode)
    italicsand a.CodA=h1.AuthorCode
    I have only a little problem... i can't use "with" clause in the exam, can u write a running query without that?

  • Help for query!!!

    Dear All,
    My query shows following type of output;
    Query:
    select  b.yearqtr,b.cgs_code,b.code,b.name1,b.total--,a.total1
    from ibs_cbs_temp b,(select name1,sum(total) as total1
                         from ibs_cbs_temp
                         group by name1) a
    where b.name1 = a.name1                    
    group by b.name1,b.yearqtr,b.cgs_code,b.code,b.total,a.total1
    order by a.total1 desc,b.name1;
    Output:
    YEARQTR     CGS_CODE     CODE     NAME1                              TOTAL
    20051     2          HK     HONG KONG                         2559
    20044     2          HK     HONG KONG                         5465
    20052     2          HK     HONG KONG                         11332460
    20044     1          GB     UNITED KINGDOM                         5355
    20051     1          GB     UNITED KINGDOM                         9742
    20052     1          GB     UNITED KINGDOM                         6960160
    20044     2          SG     SINGAPORE                         3097
    20051     2          SG     SINGAPORE                         3529
    20052     2          SG     SINGAPORE                         4695826
    20051     6          IO     BRITISH INDIAN OCEAN TERRITORY               15
    20052     6          IO     BRITISH INDIAN OCEAN TERRITORY               100
    20051     6          1W     BRITISH OVERSEAS TERRITORIES (INCL. CHAGOS)     250
    20052     6          1W     BRITISH OVERSEAS TERRITORIES (INCL. CHAGOS)     320
    20044     5          BF     BURKINA FASO (FORMERLY UPPER VOLTA)          120
    20051     5          BF     BURKINA FASO (FORMERLY UPPER VOLTA)          780
    20052     5          BF     BURKINA FASO (FORMERLY UPPER VOLTA)          60
    20044     5          BI     BURUNDI                              550
    20051     5          BI     BURUNDI                              220
    20052     5          BI     BURUNDI                              20
    Here for
    BRITISH INDIAN OCEAN TERRITORY,BRITISH OVERSEAS TERRITORIES (INCL. CHAGOS) these two countries there are no records
    for 20044 YEARQTR. For this I want to display 0 values
    like;
    20051     2          SG     SINGAPORE                         3529
    20052     2          SG     SINGAPORE                         4695826
    20044     2          SG     SINGAPORE                         0Is there any solution for this.
    Please help me.
    Thanks In advance,
    Prathamesh.

    Use this query to obtain all conbinations for yearqty and name1
    select a.yesrqtr, b.name1 FROM
    (select distinct yearqtr from ibs_cbs_temp) a,
    (select distinct name1 from ibs_cbs_temp) b;
    Add the above query to the join
    Also the the join criteria and b.yearqtr=a.yearqtr
    select b.yearqtr,b.cgs_code,b.code,b.name1,b.total
    from ibs_cbs_temp b,
    (select name1,sum(total) as total1 from ibs_cbs_temp group by name1) a,
    (select a.yesrqtr, b.name1 FROM
    (select distinct yearqtr from ibs_cbs_temp) a,
    (select distinct name1 from ibs_cbs_temp) b) c
    where b.name1 = a.name1
    and b.yearqtr=a.yearqtr
    and b.name1(+)=c.name1
    and b.yearqtr(+)=c.yearqtr
    order by a.total1 desc,b.name1;

  • Needed help for  query

    Hi All,
    Here is requirement
    User X has View only and Account manager Role then we don't need to report any changes for him. And if User Y has View Only role then we need to report his activity.
    select u.loginname, p.firstname,p.lastname,g.name
    from sc_user u, bqperson p, sc_acl_group_mem gm,
    sc_acl_group g,sc_acl_group gnm
    where u.bqperson = p.tril_gid and u.tril_groups = gm.collectiongid AND gm.objectgid =
    g.tril_gid AND
    (g.NAME LIKE 'VIEW ONLY' OR g.NAME LIKE 'SME%')
    ORDER BY loginname
    Here is out put
    LOGINNAME FIRSTNAME LASTNAME NAME
    b684276 xxx xxx VIEW ONLY
    default Guest User VIEW ONLY
    n105371 Adil Khan SME EXGRATIA ADMINISTRATOR
    n105371 Adil Khan SME SERVICE CENTRE SUPERVISOR
    n105371 Adil Khan SME PROMOTIONS ADMINISTRATOR
    n105557 Emmanuel Kajjor SME EXGRATIA ADMINISTRATOR
    n105557 Emmanuel Kajjor SME SERVICE CENTRE SUPERVISOR
    n105740 Priya Ghag SME EXGRATIA ADMINISTRATOR
    n105740 Priya Ghag SME SERVICE CENTRE SUPERVISOR
    n106311 Megha Nalawade SME EXGRATIA ADMINISTRATOR
    n106311 Megha Nalawade SME SERVICE CENTRE SUPERVISOR
    n106311 Megha Nalawade SME PROMOTIONS ADMINISTRATOR
    n107864 Ragini Sule SME EXGRATIA ADMINISTRATOR
    n107864 Ragini Sule SME SERVICE CENTRE SUPERVISOR
    n107864 Ragini Sule SME PROMOTIONS ADMINISTRATOR
    n110022 Harikrishna Kurup SME EXGRATIA ADMINISTRATOR
    n110022 Harikrishna Kurup SME SERVICE CENTRE SUPERVISOR
    n110022 Harikrishna Kurup SME PROMOTIONS ADMINISTRATOR
    n110450 Rachana Vasandani SME EXGRATIA ADMINISTRATOR
    n110450 Rachana Vasandani SME SERVICE CENTRE SUPERVISOR
    n110932 Jigna Trivedi SME EXGRATIA ADMINISTRATOR
    n110932 Jigna Trivedi SME PROMOTIONS ADMINISTRATOR
    n110932 Jigna Trivedi SME SERVICE CENTRE SUPERVISOR
    Please advice
    Thanks in advance
    Sachin

    Hi Sudeep,
    Account manager is Simply a role like View Only and 'SME %'
    Some user can have Roles Like 'View only' ,'Account manager' ,'SME%' They are all differnt Role
    Some user Can have only 'View only' Role
    Some user can have 'SMe%' Role
    Some user can have 'SMe%' , 'Account manager' Role
    etc probabilites
    I want to retrieve the record for thiose user who have 'View only' Role or 'SMe%' Role
    Some times it might happened user can have 'View only' ,'Account manager' ,'SME%' .This should come in list
    if USer has any role with 'Account Manager' its result should not appear in Query other wise it should appear

  • Online Help for Query Builder

    All,
    I am new to using Query Builder, but I found a tutorial at:
    http://otn.oracle.com/products/forms/htdocs/d2k/qb/qb1.htm
    When I got to the last slide, it make reference to the "Query Builder Online Help", but I cannot find it. Can anyone help?

    Hi,
    http://www.oracle.com/technology/products/database/application_express/index.html
    http://www.oracle.com/technology/products/database/application_express/html/doc.html
    Good Reading,
    Sim

  • Need help for query

    I have Table1
    ID -- Key -- Name -- City
    1--R1--abc--xyz
    2--R1--abc--xyz
    3--R1--pqr--xyz
    4--R1--abc--xyz
    5--R1--abc--stp
    6--R2--abc1--xyz1
    7--R2--abc1--xyz1
    8--R2--pqr1--xyz1
    9--R2--abc1--xyz1
    10--R2--abc1--stp1
    I want to get result - Max(ID) where Key + Name + City is same for all rows. there should be one max per key
    and result like -
    Key-- MaxID
    R1--4
    R2--9
    Edited by: 871447 on Oct 19, 2011 1:54 PM
    Edited by: 871447 on Oct 19, 2011 1:56 PM

    Maybe (NOT TESTED!)
    select key,max_id
      from (select key,name,city,max(id) max_id,count(*) cnt
              from table1
             group by key,name,city
    where cnt > 1Regards
    Etbin

  • Require help for query

    hi all,
    i had 3 tables
    1) SERV_AUTH_DETAIL WITH COLUMNS
    SERV_AUTH_DETAIL_ID
    NUMBER_OF_UNITS
    UNIT_COST
    SERV_ID
    2) PUR_ORDER_DETAIL WITH COLUMNS
    PUR_ORDER_DETAIL_ID
    PUR_ORDER_ID
    NUMBER_OF_UNITS
    UNIT_COST
    SERV_AUTH_DETAIL_ID
    3) PUR_ORDER WITH COLUMNS
    PUR_ORDER_ID
    SERV_AUTH_ID
    PUR_ORDER_STATUS
    when i issue the following update statement, i got the error stating
    column ambiguously defined
    update t_serv_auth_detail
    set number_of_units = (select number_of_units
    from t_pur_order_detail pod
    join t_serv_auth_detail sa
    on
    pod.serv_auth_detail_id = sa.serv_auth_detail_id
    and pod.pur_order_id = 1)
    where serv_auth_detail_id = (select s.serv_auth_detail_id
    from t_pur_order_detail p
    join t_pur_order po
    on
    p.pur_order_id = po.pur_order_id
    and po.pur_order_id = 1)
    ERROR at line 2:
    ORA-00918: column ambiguously defined
    could anyone give guidelines to correct this error.
    thanks in advance.
    rampa

    In your UPDATE statement:
    UPDATE t_SERV_AUTH_DETAIL SA
       SET NUMBER_OF_UNITS = (SELECT NUMBER_OF_UNITS
                                FROM t_PUR_ORDER_DETAIL POD
                               WHERE POD.SERV_AUTH_DETAIL_ID = SA.SERV_AUTH_DETAIL_ID
                                 AND POD.PUR_ORDER_ID = 1)
    WHERE SERV_AUTH_DETAIL_ID = (SELECT P.SERV_AUTH_DETAIL_ID
                                    FROM t_PUR_ORDER_DETAIL P
                                    JOIN t_PUR_ORDER PO
                                      ON P.PUR_ORDER_ID = PO.PUR_ORDER_ID
                                     AND PO.PUR_ORDER_ID = 1);the 2nd subquery - SELECT P.SERV_AUTH_DETAIL_ID...
    is returning more than one row and you have used a "=" operator to match it. That's the reason for that ORA error.
    pratz

  • Help needed in tuning a query

    Hi,
    I need some help in performing tuning of a big query. Explain plan is as under:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    Edited by: AbdulHadi on Sep 16, 2011 3:56 PM
    Edited by: AHadi on Sep 19, 2011 10:02 AM

    3     SORT GROUP BY          47916     25M     491G     15M (3)     17:30:31               
    4     VIEW          870M     445G          15M (2)     17:24:08               
    5     HASH GROUP BY          870M     427G     885G     15M (2)     17:24:08               
    In above steps its using very high temporary tablespace usage. please try to tune your query.
    - dynamic sampling used for this statement
    The statistics appears to be stale.

  • Need Help to query Lync Database for User Information

    Need Help to Query the lync database to retrieve below user information.
    1. SIP Address of the registered user
            2. Phone Number configured to the particular account.
            3. IP Address
           4. Last Logged in time.
    I am trying to pull the above information from rtc database for all the registered users. Please let me know if this is possible and it would be great if you can throw some light on what tables to look for the data. Thank You.

    Hi,
    For SIP address and Phone number you can check RTC database.
    IP Address:
    You can refer to the link below to query IP address: 
    http://h30499.www3.hp.com/t5/Business-Service-Management-BAC/Monitoring-Lync-with-the-User-Registrations-Viewer-Free-NMC-tool/ba-p/5961497#.UtOU43mIrwo
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
    Last Logged in time:
    You can refer to the link below:
    http://blogs.technet.com/b/dodeitte/archive/2011/05/11/how-to-get-the-last-time-a-user-registered-with-a-front-end.aspx
    Best Regards,
    Eason Huang
    Eason Huang
    TechNet Community Support

  • Please reply for the query tuning

    Hi, i am a beginner in oracle dba, I have to know if i have studied little bit about query tuning in ORACLE.
    I wanna know if i have the following query and its plan then how it can be tuned:
    QUERY:
              SELECT z.emplid ,h.first_name || ' ' || h.last_name  ,z.grade ,z.DEPTID ,z.LOCATION
                              FROM sysadm.ps_lnt_latestbu_vw z, sysadm.ps_personal_data h
                                    WHERE  z.empl_status ='A'    --index access
                                    AND z.emplid = h.emplid      --join
                                    and z.emplid not in   (select g.emplid from sysadm.ps_lnt_asn_skl_tbl g)    --join
                                    and z.Business_unit=
                                                               (      select l.lnt_subunit from sysadm.ps_position_data l where l.position_nbr in
                                                                                                    ( select b.position_nbr from sysadm.ps_job b,sysadm.psoprdefn y
                                                                                                              where b.effdt=(     select max(g.effdt) from sysadm.ps_job g
                                                                                                                                            where g.emplid=b.emplid           --join costs high
                                                                                                                                                and g.effdt<=SYSDATE)               --filter/index
                                                                                                                    and b.effseq=
                                                                                                                             (select max(h.effseq) from sysadm.ps_job h
                                                                                                                                       where h.emplid=b.emplid           --join costs high
                                                                                                                                      and h.effdt=b.effdt)               --join costs high
                                                                                                                and b.empl_rcd=0          --filter/index access
                                                                                                                and y.EMPLID=b.EMPLID  --join
                                                                                                                and y.OPRID='1112'   -- filter/index access
                                               order by z.emplid
                                            /AND its plan is:
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=6 Card=1 Bytes=64)
       1    0   SORT (ORDER BY) (Cost=6 Card=1 Bytes=64)
       2    1     NESTED LOOPS (ANTI) (Cost=4 Card=1 Bytes=64)
       3    2       NESTED LOOPS (Cost=3 Card=1 Bytes=56)
       4    3         VIEW OF 'PS_LNT_LATESTBU_VW' (Cost=2 Card=1 Bytes=31)
       5    4           UNION-ALL
       6    5             CONCATENATION
       7    6               TABLE ACCESS (BY INDEX ROWID) OF 'PS_POSITION_DATA' (Cost=5 Card=90 Bytes=1890)
       8    7                 NESTED LOOPS
       9    8                   NESTED LOOPS (Cost=275 Card=1 Bytes=90)
      10    9                     NESTED LOOPS (Cost=275 Card=1 Bytes=82)
      11   10                       TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=50)
      12   11                         INDEX (RANGE SCAN) OF 'PS2JOB' (NON-UNIQUE) (Cost=2 Card=1)
      13   12                           SORT (AGGREGATE)
      14   13                             FIRST ROW (Cost=3 Card=1 Bytes=19)
      15   14                               INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700)
      16   12                           SORT (AGGREGATE)
      17   16                             FIRST ROW (Cost=3 Card=1 Bytes=22)
      18   17                               INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700)
      19   10                       INDEX (UNIQUE SCAN) OF 'PS_EMPLOYMENT'(UNIQUE)
      20    9                     INDEX (UNIQUE SCAN) OF 'PS_PERSONAL_DATA' (UNIQUE)
      21    8                   INDEX (RANGE SCAN) OF 'PS_POSITION_DATA' (UNIQUE) (Cost=5 Card=90)
      22    6               FILTER
      23   22                 NESTED LOOPS (Cost=275 Card=1 Bytes=90)
      24   23                   NESTED LOOPS (Cost=275 Card=1 Bytes=82)
      25   24                     NESTED LOOPS (Cost=275 Card=1 Bytes=71)
      26   25                       INDEX (FAST FULL SCAN) OF 'PS8POSITION_DATA' (NON-UNIQUE) (Cost=5 Card=90 Bytes=1890)
      27   25                       TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=50)
      28   27                         INDEX (RANGE SCAN) OF 'PS2JOB' (NON-UNIQUE) (Cost=2 Card=1)
      29   28                           SORT (AGGREGATE)
      30   29                             FIRST ROW (Cost=3 Card=1 Bytes=22)
      31   30                               INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700)
      32   28                           SORT (AGGREGATE)
      33   32                             FIRST ROW (Cost=3 Card=1 Bytes=19)
      34   33                               INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700)
      35   24                     INDEX (UNIQUE SCAN) OF 'PS_EMPLOYMENT' (UNIQUE)
      36   23                   INDEX (UNIQUE SCAN) OF 'PS_PERSONAL_DATA'(UNIQUE)
      37   22                 SORT (AGGREGATE)
      38   37                   FIRST ROW (Cost=2 Card=1 Bytes=17)
      39   38                     INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_POSITION_DATA' (UNIQUE) (Cost=2 Card=9000)
      40    5             FILTER
      41   40               NESTED LOOPS (Cost=751 Card=1 Bytes=191)
      42   41                 NESTED LOOPS (OUTER) (Cost=750 Card=1 Bytes=167)
      43   42                   NESTED LOOPS (OUTER) (Cost=749 Card=1 Bytes=143)
      44   43                     NESTED LOOPS (Cost=748 Card=1 Bytes=134)
      45   44                       NESTED LOOPS (Cost=748 Card=1 Bytes=123)
      46   45                         NESTED LOOPS (Cost=748 Card=1 Bytes=119)
      47   46                           NESTED LOOPS (Cost=747 Card=1 Bytes=98)
      48   47                             NESTED LOOPS (Cost=744 Card=1 Bytes=62)
      49   48                               NESTED LOOPS (Cost=744 Card=1Bytes=54)
      50   49                                 VIEW OF 'PS_LNTPRJOBSYSJRVW'(Cost=741 Card=1 Bytes=9)
      51   50                                   FILTER
      52   51                                     NESTED LOOPS (OUTER) (Cost=735 Card=1 Bytes=68)
      53   52                                       NESTED LOOPS (Cost=734Card=1 Bytes=51)
      54   53                                         NESTED LOOPS (Cost=734 Card=1 Bytes=43)
      55   54                                           TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=734 Card=1 Bytes=32)
      56   55                                             INDEX (RANGE SCAN) OF 'PSCJOB' (NON-UNIQUE) (Cost=206 Card=1013)
      57   54                                           INDEX (UNIQUE SCAN) OF 'PS_EMPLOYMENT' (UNIQUE)
      58   53                                         INDEX (UNIQUE SCAN) OF 'PS_PERSONAL_DATA' (UNIQUE)
      59   52                                       INDEX (RANGE SCAN) OF'PS_POSITION_DATA' (UNIQUE) (Cost=1 Card=1 Bytes=17)
      60   51                                     SORT (AGGREGATE)
      61   60                                       FIRST ROW (Cost=3 Card=1 Bytes=19)
      62   61                                         INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700)
      63   51                                     SORT (AGGREGATE)
      64   63                                       FIRST ROW (Cost=3 Card=1 Bytes=22)
      65   64                                         INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700)
      66   51                                     SORT (AGGREGATE)
      67   66                                       FIRST ROW (Cost=2 Card=1 Bytes=17)
      68   67                                         INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_POSITION_DATA' (UNIQUE) (Cost=2 Card=9000)
      69   49                                 TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=45)
      70   69                                   INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=1)
      71   70                                     SORT (AGGREGATE)
      72   71                                       INDEX (RANGE SCAN) OF'PSAJOB' (NON-UNIQUE) (Cost=3 Card=1 Bytes=19)
      73   72                                         SORT (AGGREGATE)
      74   73                                           FIRST ROW (Cost=3Card=8 Bytes=88)
      75   74                                             INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=25963)
      76   70                                     SORT (AGGREGATE)
      77   76                                       FIRST ROW (Cost=3 Card=8 Bytes=88)
      78   77                                         INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=25963)
      79   48                               INDEX (UNIQUE SCAN) OF 'PS_PERSONAL_DATA' (UNIQUE)
      80   47                             TABLE ACCESS (BY INDEX ROWID) OF'PS_JOB' (Cost=3 Card=1 Bytes=36)
      81   80                               INDEX (RANGE SCAN) OF 'PSAJOB'(NON-UNIQUE) (Cost=2 Card=1)
      82   81                                 SORT (AGGREGATE)
      83   82                                   FIRST ROW (Cost=3 Card=1 Bytes=19)
      84   83                                     INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700)
      85   81                                 SORT (AGGREGATE)
      86   85                                   FIRST ROW (Cost=3 Card=1 Bytes=22)
      87   86                                     INDEX (RANGE SCAN (MIN/MAX)) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=207700)
      88   46                           INDEX (RANGE SCAN) OF 'PS8POSITION_DATA' (NON-UNIQUE) (Cost=1 Card=1 Bytes=21)
      89   45                         INDEX (UNIQUE SCAN) OF 'PS_BUS_UNIT_TBL_HR' (UNIQUE)
      90   44                       INDEX (UNIQUE SCAN) OF 'PS_EMPLOYMENT'(UNIQUE)
      91   43                     INDEX (RANGE SCAN) OF 'PS_POSITION_DATA'(UNIQUE) (Cost=1 Card=1 Bytes=9)
      92   42                   INDEX (FULL SCAN) OF 'PS0LOCATION_TBL' (NON-UNIQUE) (Cost=1 Card=1 Bytes=24)
      93   41                 INDEX (RANGE SCAN) OF 'PS0LOCATION_TBL' (NON-UNIQUE) (Cost=1 Card=1 Bytes=24)
      94   40               SORT (AGGREGATE)
      95   94                 FIRST ROW (Cost=2 Card=1 Bytes=17)
      96   95                   INDEX (RANGE SCAN (MIN/MAX)) OF 'PS_POSITION_DATA' (UNIQUE) (Cost=2 Card=9000)
      97    4           TABLE ACCESS (BY INDEX ROWID) OF 'PS_POSITION_DATA' (Cost=2 Card=1 Bytes=13)
      98   97             NESTED LOOPS (Cost=9 Card=1 Bytes=19)
      99   98               VIEW OF 'VW_NSO_1' (Cost=5 Card=1 Bytes=6)
    100   99                 SORT (UNIQUE)
    101  100                   NESTED LOOPS (Cost=5 Card=1 Bytes=44)
    102  101                     TABLE ACCESS (BY INDEX ROWID) OF 'PSOPRDEFN' (Cost=2 Card=1 Bytes=14)
    103  102                       INDEX (UNIQUE SCAN) OF 'PS_PSOPRDEFN'(UNIQUE) (Cost=1 Card=1)
    104  101                     TABLE ACCESS (BY INDEX ROWID) OF 'PS_JOB' (Cost=3 Card=1 Bytes=30)
    105  104                       INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=2 Card=1)
    106  105                         SORT (AGGREGATE)
    107  106                           INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=8 Bytes=128)
    108  105                         SORT (AGGREGATE)
    109  108                           INDEX (RANGE SCAN) OF 'PSAJOB' (NON-UNIQUE) (Cost=3 Card=1 Bytes=19)
    110   98               INDEX (RANGE SCAN) OF 'PS_POSITION_DATA' (UNIQUE) (Cost=1 Card=1)
    111    3         TABLE ACCESS (BY INDEX ROWID) OF 'PS_PERSONAL_DATA'(Cost=1 Card=1 Bytes=25)
    112  111           INDEX (UNIQUE SCAN) OF 'PS_PERSONAL_DATA' (UNIQUE)
    113    2       INDEX (RANGE SCAN) OF 'PS_LNT_ASN_SKL_TBL' (UNIQUE) (Cost=1 Card=10076 Bytes=80608)
    Statistics
             70  recursive calls
              0  db block gets
        1186931  consistent gets
           5660  physical reads
             60  redo size
            462  bytes sent via SQL*Net to client
            373  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              2  sorts (memory)
              0  sorts (disk)
              0  rows processedMy thoughts for this is:
    1. NLJ high cost -- rewrite inner sub-query
    2. sort is done for each join for max function every time so,     therefore try use use sort merge hint
    3. h           alias has been referenced twice for table name.
    PLEASE TELL ME WHAT TO DO IF I AM ORACLE DBA.
    Thanks in advance.
    Edited by: user2060331 on Mar 25, 2010 9:17 AM
    Edited by: user2060331 on Mar 25, 2010 9:21 AM
    Edited by: user2060331 on Mar 25, 2010 9:32 AM
    Edited by: user2060331 on Mar 25, 2010 9:47 AM

    No it's not. You should see indentations for each level of the explain plan. You've lost all of it. It should look like this (not your query):
    PLAN_TABLE_OUTPUT
    | Id  | Operation                   | Name                | Rows  | Bytes | Cost  | Inst   |IN-OUT|
    |   0 | SELECT STATEMENT            |                     | 16116 |  2911K|   712 |        |      |
    |   1 |  FILTER                     |                     |       |       |       |        |      |
    |   2 |   CONNECT BY WITH FILTERING |                     |       |       |       |        |      |
    |   3 |    FILTER                   |                     |       |       |       |        |      |
    |   4 |     COUNT                   |                     |       |       |       |        |      |
    |   5 |      HASH JOIN RIGHT OUTER  |                     | 16116 |  2911K|   712 |        |      |
    |   6 |       REMOTE                | LSW_USR_GRP_XREF    |   518 | 13986 |     4 | MYPROJ~ | R->S |
    |   7 |       HASH JOIN RIGHT OUTER |                     | 16116 |  2486K|   707 |        |      |
    |   8 |        REMOTE               | LSW_USR_XREF        |   222 |  2886 |     4 | MYPROJ~ | R->S |
    |   9 |        HASH JOIN RIGHT OUTER|                     | 16116 |  2282K|   702 |        |      |
    |  10 |         TABLE ACCESS FULL   | MYPROJ_PROCESS_MAP   |   176 |  4752 |     4 |        |      |
    |  11 |         HASH JOIN OUTER     |                     | 16116 |  1857K|   698 |        |      |
    |  12 |          TABLE ACCESS FULL  | MYPROJ_MPPA | 16116 |  1243K|    71 |        |      |
    |  13 |          REMOTE             | LSW_TASK            | 80730 |  3074K|   625 | MYPROJ~ | R->S |
    |  14 |    HASH JOIN                |                     |       |       |       |        |      |
    |  15 |     CONNECT BY PUMP         |                     |       |       |       |        |      |
    |  16 |     COUNT                   |                     |       |       |       |        |      |
    |  17 |      HASH JOIN RIGHT OUTER  |                     | 16116 |  2911K|   712 |        |      |
    |  18 |       REMOTE                | LSW_USR_GRP_XREF    |   518 | 13986 |     4 | MYPROJ~ | R->S |
    |  19 |       HASH JOIN RIGHT OUTER |                     | 16116 |  2486K|   707 |        |      |
    |  20 |        REMOTE               | LSW_USR_XREF        |   222 |  2886 |     4 | MYPROJ~ | R->S |
    |  21 |        HASH JOIN RIGHT OUTER|                     | 16116 |  2282K|   702 |        |      |
    |  22 |         TABLE ACCESS FULL   | MYPROJ_PROCESS_MAP   |   176 |  4752 |     4 |        |      |
    |  23 |         HASH JOIN OUTER     |                     | 16116 |  1857K|   698 |        |      |
    |  24 |          TABLE ACCESS FULL  | MYPROJ_MPPA | 16116 |  1243K|    71 |        |      |
    |  25 |          REMOTE             | LSW_TASK            | 80730 |  3074K|   625 | MYPROJ~ | R->S |
    ---------------------------------------------------------------------------------------------------

  • Need help with LikeFilter for querying the keyset instead of value

    Hi,
    I'm looking for help with the LikeFilter.
    I need to query the cache to get all entries with key starting with a particular string.
    I could see samples using LikeFilter for querying the values in the cache but not the keyset.
    Can someone help?
    E.g:
    Cache Entries:
    abc123 - value1
    abc234 - value2
    bcd123 - value3
    I want to get all entries with key starting with 'abc'.
    thanks,
    rama.

    NJ, thanks for the quick reply.
    I tried something similar (as below) but this code gives me 'java.lang.NoClassDefFoundError: com/tangosol/util/ValueExtractor'.
    KeyExtractor extractor = new KeyExtractor("getKey");
    Filter filter = new LikeFilter(extractor, id+":%",'-',false);
    -rama.
    Edited by: 911950 on Feb 2, 2012 1:18 PM

  • Required help for a query

    Hi All....
    Required help for one more query.
    I have a table with data like this:
    Cust_id Transaction_no
    111 1
    111 2
    111 3
    111 4
    111 5
    111 6
    222 7
    222 8
    333 9
    333 10
    333 11
    333 12
    I wrote the following query :
    select cust_id, ntile(3) over (order by cust_id) "Bucket" from trans_detls
    The output is like this :
    Cust_id Bucket
    111 1
    111 1
    111 1
    111 1
    111 2
    111 2
    222 2
    222 2
    333 3
    333 3
    333 3
    333 3
    The problem is that I dont want the cust_id to overlap in buckets. That is one cust_id should be present in only one bucket.
    Is this possible?
    Thanks in advance.
    Ameya

    Or Something like..
    SQL> select * from test;
            ID         NO
           111          1
           111          2
           111          3
           111          4
           111          5
           111          6
           222          7
           222          8
           333          9
           333         10
           333         11
           333         12
    12 rows selected.
    SQL> select id, ntile(3) over (order by rn) "Bucket"
      2  from(
      3      select id,row_number() over(partition by id order by no) rn
      4      from test);
            ID     Bucket
           111          1
           222          1
           333          1
           111          1
           222          2
           333          2
           111          2
           333          2
           111          3
           333          3
           111          3
           111          3
    12 rows selected.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for