Query Tuning requirements.

Hello

I'm not as good as in sql queries and joins the digital smart writing Sql.

Think of me as a dba and task is to resolve queries wrong, what I should know basic, intermediate, advance level query tuning. also consider that the developers have only a large part of the knowledge to optimize queries.

Query tuning requires knowledge of PL/SQL? because the guys on developer close to me wrote anonymous PL/SQL blocks most of the time.

Thank you

user12187861 wrote:

Hello

I'm not as good as in sql queries and joins the digital smart writing Sql.

Think of me as a dba and task is to resolve queries wrong, what I should know basic, intermediate, advance level query tuning. also consider that the developers have only a large part of the knowledge to optimize queries.

Query tuning requires knowledge of PL/SQL? because the guys on developer close to me wrote anonymous PL/SQL blocks most of the time.

Thank you

Setup of the query can be taught on the forums. Please buy Troubleshooting Oracle Performance (Apress), CBO Fundamentals (Apress) and Oracle practice 8i(Addison Wesley) and read them with a blanket. In the meantime read to keep on trying to make efforts to make queries resolved in accordance with instructions learned in these books.

Good luck!

Aman...

Tags: Database

Similar Questions

  • Please answer for the query tuning

    Hi, I am a beginner in oracle dba, I need to know if I have studied little query tuning ORACLE.
    I want to know if I have the following query and its plan so 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 his 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 processed
    My thoughts for this is:

    1 NLJ high cost - rewrite a subquery internal

    2. sort is performed for each join for max function every time so try so use use sort merge hint

    3 h alias has been referenced twice for the name of the table.




    PLEASE ME TELL IF I AM ORACLE DBA.

    Thanks in advance.

    Published by: user2060331 on March 25, 2010 09:17

    Published by: user2060331 on March 25, 2010 09:21

    Published by: user2060331 on March 25, 2010 09:32

    Published by: user2060331 on March 25, 2010 09:47

    Seriously, peoplel aren't going to be able to read your message in this format on the forum.

    Use the button Edit to edit your post and make sure your code/explain plants etc has {noformat}

    {noformat} tags both before and after it so that the formatting is retained and we can read it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    
  • SQL Query Tuning (large table)

    Hi all

    Ask your help for Tuning below mentioned simple query.


    SELECT distinct BROKER_CODE FROM PROCESSED_TRXNS WHERE FOLIO_NO = '101302'

    Top query takes about 15 seconds to give the output.

    Explain the plan: -.

    Hash value of plan: 2775832988

    -----------------------------------------------------------------------------------------
    | ID | Operation | Name               | Lines | Bytes | Cost (% CPU). Time |
    -----------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT |                    |    29.   609 | 38241 (1) | 00:07:39 |
    |   1.  UNIQUE NOSORT FATE.                    |    29.   609 | 38241 (1) | 00:07:39 |
    |*  2 |   INDEX SKIP SCAN | PROCTRAN_BRC_FN_C1 |    29.   609 | 38240 (1) | 00:07:39 |
    -----------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    2 - access ("FOLIO_NO" = '101302')
    Filter ("FOLIO_NO" = '101302')


    Additional info: -.


    SELECT COUNT (1) IN PROCESSED_TRXNS - 135989170

    Composite index on BROKER_CODE, FOLIO_NO in the table

    The optimizer expects that the skip scan to take at 7:39 min - so the 15 sec are not so bad. And I'm sure that the operation is faster than a full Table Scan on PROCESSED_TRXNS. If you do not have a post adjustment index more then the skip scan might indeed be the best available strategy. I expect an index on PROCESSED_TRXNS (FOLIO_NO, BROKER_CODE) to be more effective for the query, because it should allow a range of index analysis which should read only the part of the index with the given FOLIO_NO. But create additional indexes will obviously slow down DML and could have an impact on other query execution plans (and not necessarily a positive impact).

  • Query patterns: required field

    Using 11g, I created a basic application model, and it is clear how fields visible/not visible and limited to certain comments, but how do I make some of the required/not required form fields?

    Certainly, there is problem in the dataset query



    Please check with above sample AttributeReference for research. ensure that field to display and record-field

    -Kuldeep

  • SQL Query Tuning

    I have a question that needs to be tuned... This query is executed a lot of time during the day so total run time is high... Here are the details
    qUERY
    
    SELECT col1 , col2 , col3 FROM table1 WHERE col4 = '200' AND
     col2 IN ('123ABC','234/AF','AKJF/R','67KJAF/S','AD45/R') 
    AND COL1 IN ('NEWY','OHIO','WADC','CALI','PHYL','ILLI') 
    AND COL5 = ' ';
    
    
    SQL> select banner from v$version
      2  ;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
    PL/SQL Release 10.2.0.2.0 - Production
    CORE    10.2.0.2.0      Production
    TNS for Solaris: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    
    SQL> select banner from v$version
      2  ;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
    PL/SQL Release 10.2.0.2.0 - Production
    CORE    10.2.0.2.0      Production
    TNS for Solaris: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    
    SQL> SHOW PARAMETER OPTIMIZER
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    _optimizer_mjc_enabled               boolean     FALSE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      10.2.0.2
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     20
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    SQL> show parameter db_file_multi
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    db_file_multiblock_read_count        integer     128
    SQL> show parameter cursor_sharing
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    cursor_sharing                       string      EXACT
    
    SQL> column sname format a20
    SQL> column pname format a20
    SQL>column pval2 format a20
    select sname, pname, pval1, pval2
    SQL> from  sys.aux_stats$;
    
    SNAME                PNAME                     PVAL1 PVAL2
    -------------------- -------------------- ---------- --------------------
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          11-10-2009 13:57
    SYSSTATS_INFO        DSTOP                           11-10-2009 13:57
    SYSSTATS_INFO        FLAGS                         1
    SYSSTATS_MAIN        CPUSPEEDNW             1417.876
    SYSSTATS_MAIN        IOSEEKTIM                11.022
    SYSSTATS_MAIN        IOTFRSPEED            15576.989
    SYSSTATS_MAIN        SREADTIM                  2.844
    SYSSTATS_MAIN        MREADTIM                   .829
    SYSSTATS_MAIN        CPUSPEED                    715
    SYSSTATS_MAIN        MBRC                          8
    
    SNAME                PNAME                     PVAL1 PVAL2
    -------------------- -------------------- ---------- --------------------
    SYSSTATS_MAIN        MAXTHR                 19869696
    SYSSTATS_MAIN        SLAVETHR
    
    13 rows selected.
    
    SQL> explain plan for  SELECT col1 , col2 , col3 FROM table1 WHERE col4 = '200' AND
     col2 IN ('123ABC','234/AF','AKJF/R','67KJAF/S','AD45/R') 
    AND COL1 IN ('NEWY','OHIO','WADC','CALI','PHYL','ILLI') 
    AND COL5 = ' ';
     4  
    Explained.
    
    SQL> select * from table(dbms_xplan.display);
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------
    
    ----------------------------------------------------------------------------
    | Id  | Operation                    | Name   | Rows  | Bytes | Cost (%CPU)|
    ----------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |        |    27 |   783 |    12   (9)|
    |   1 |  INLIST ITERATOR             |        |       |       |            |
    |   2 |   TABLE ACCESS BY INDEX ROWID| TABLE1 |    27 |   783 |    11   (0)|
    |   3 |    INDEX RANGE SCAN          | INDEX1 |    27 |       |     7   (0)|
    ----------------------------------------------------------------------------
    
    Note
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------
    -----
       - 'PLAN_TABLE' is old version
    
    13 rows selected.
    Please let me know if more info I needed

    Published by: njafri on January 5, 2010 13:33
  • dbms_sqltune, need to create a task for SQL 16 pages query tuning

    Gurus,

    They gave me 16 pages (pages in MS Word :), well, this isn't very funny, query.)

    DBMS_SQLTUNE. CREATE_TUNING_TASK accepts sql_text as VARCHAR2, but the chain is medium length.

    Any ideas on how this can be addressed?

    I don't have sqlid.

    Thank you

    Anatoliy

    He accepts sql_text as a CLOB.

  • Query Tuning

    Hi all

    This my table structure.

    create table t_department (td_code varchar2 (10), td_description varchar2 (200));

    This table contains 1 million records.

    It's my request,

    Select td_code. » -'|| td_description search_term,

    of t_department

    where REGEXP_LIKE (upper(td_code||) e -'|| td_description), Upper ('ISS'), 'i');

    If running above query, it takes 10 seconds. But, the two columns (td_code, td_description) of the index. Always take the time.

    But if I run like query below, it will take only 0.53 seconds.


    Select td_code. » -'|| td_description search_term,

    of t_department

    where td_code like UPPER ('IGB%');

    Please help me on this.

    Kind regards

    Fame

    Maybe

    Select td_code |' | ' || td_description search_term,

    of t_department

    where instr (lower (td_code |'|)) ' || td_description), lower (:user_input)) > 0

    Concerning

    Etbin

  • With functions in the SQL query tuning

    Hello

    I'm trying to settle a query with functions in the select section. You wonder how to see the results of the plan to explain these features included. Will there be a qs to include when you run the explain plan command

    Thank you

    Hilton

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    PL/SQL Release 11.2.0.3.0 - Production

    "CORE 11.2.0.3.0 Production."

    AMT for Linux: Version 11.2.0.3.0 - Production

    NLSRTL Version 11.2.0.3.0 - Production

    Thank you. The function is not in the where clause but in the query using some of the returned columns. I realized that using the trace gave me the plan explanation of each of the functions.

  • Query tuning steps

    Hi all

    Can we please give me steps to query tunning

    Salvation;

    Please see the link I shared in my previous post

    Respect of
    HELIOS

  • Problem with the performance of a query tuning

    Hello

    I have a question which is in the below format

    Select a.* from
    (online query),

    (inline query b)
    where a.id = b.id;

    Now I want the inline query b to be executed first, then joined with a.

    How can I achieve the same.

    Let me know if you need more information.
  • Query tuning help

    Can someone help me with this piece of the request that the request is to consume a lot of time. Maybe we can avoid selecting double. Can someone suggest an alternative?

    SELECT sd.specification_sequence_no, sd.attribute_desc,
    SD.specification_lov, sd.specification_code_table,
    SD.specification_query, d.val
    OF sa_spec_template_details sd,.
    (SELECT l_chr_spec_desc01 dsc, l_chr_spec_val01 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc02 dsc, l_chr_spec_val02 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc03 dsc, l_chr_spec_val03 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc04 dsc, l_chr_spec_val04 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc05 dsc, l_chr_spec_val05 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc06 dsc, l_chr_spec_val06 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc07 dsc, l_chr_spec_val07 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc08 dsc, l_chr_spec_val08 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc09 dsc, l_chr_spec_val09 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc10 dsc, l_chr_spec_val10 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc11 dsc, l_chr_spec_val11 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc12 dsc, l_chr_spec_val12 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc13 dsc, l_chr_spec_val13 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc14 dsc, l_chr_spec_val14 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc15 dsc, l_chr_spec_val15 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc16 dsc, l_chr_spec_val16 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc17 dsc, l_chr_spec_val17 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc18 dsc, l_chr_spec_val18 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc19 dsc, l_chr_spec_val19 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc20 dsc, l_chr_spec_val20 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc21 dsc, l_chr_spec_val21 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc22 dsc, l_chr_spec_val22 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc23 dsc, l_chr_spec_val23 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc24 dsc, l_chr_spec_val24 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc25 dsc, l_chr_spec_val25 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc26 dsc, l_chr_spec_val26 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc27 dsc, l_chr_spec_val27 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc28 dsc, l_chr_spec_val28 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc29 dsc, l_chr_spec_val29 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc30 dsc, l_chr_spec_val30 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc31 dsc, l_chr_spec_val31 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc32 dsc, l_chr_spec_val32 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc33 dsc, l_chr_spec_val33 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc34 dsc, l_chr_spec_val34 val
    OF THE DOUBLE
    UNION
    SELECT l_chr_spec_desc35 dsc, l_chr_spec_val35 val
    D FROM DUAL)
    WHERE sd.plant = p_plant
    AND sd.specification_type = p_specification_type
    AND sd.specification_category = p_specification_category
    AND sd.attribute_desc = d.dsc (+)
    ORDER BY sd.specification_sequence_no;

    When your query takes too long...

  • help with a query tuning

    Hello

    My DB is 9.2.0.8 and OS RHEl 4
    SELECT  DISTINCT A.PSFF_CO_AGF_BDI,A.PSFF_IN_EX_FAC_DTL,A.PSFF_IN_ABO_RESERV
              A.PSFF_FX_INI_VIGENCIA , A.PSFF_FX_FIN_VIGENCIA , A.PGSC_CO_SCCO , A.AGFS_CO_CLIENTE ,B.CO_CUC_CABECERA    
              FROM MNPSFFMO A , MNESTAAO B WHERE  
              A.AGFS_CO_CLIENTE = B.CO_CUC_CLIENTE   
              AND 
              A.PSFF_CO_AGF_BDI in(select DISTINCT psqy_co_agf_bdi from mnpsqymo where 
                                               psqy_co_agf_bdi is not null
                                               and PBPS_CO_HITO = 'MNHITO03' and PSQY_CO_ESTADO_EL_AGF in ('A', 'C'))
              AND B.CO_HITO = 'MNHITO03'
    his plan to explain is
    OPERATION                                   Object Name                   Operation                                  Cost
    
    Select statement                                                                                                                           163
    sort                                                                                               unique                                     163
    hash join                                                                                                                                       139
    table access                                   MNESTAAO                                  full                                            4
    merge join                                                                                                                                    134
    table access                                   MNPSFFMO                                by index rowid                            53
    index                                            INDEX4                                     full scan                                     26
    sort                                                                                              join                                          81
    table access                                   MNPSQYMO                              by index rowid                            72
    index                                             INDEX10                                full scan                                       26

    Hello
    first read this:
    http://www.morganslibrary.org/reference/tuning.html

    and then consider your options.

  • This query tuning

    Hi all... I am in the process of update query. I go through the explain plan... command and it shows a comprehensive in 3 places even when the indexes are available. could you help me with the setting of the query. Also I'd like to understand how to map the query with the query plan that is to say

    where can I find ID = 13 in the query?


    Query

    SELECT

    usr. USR_ID,
    Prod.prod_type_nm,
    Prod.prod_cd,
    Prod.prod_fam_cd,
    Prod.prod_full_nm,
    Prod.prod_shrt_nm,
    Prod.product_hierarchy,
    pvlg.pvlg_nm,
    pvlg.pvlg_cd,
    pvlg.pvlg_val_tx

    FROM (SELECT DISTINCT usr_id, pvlg_dim_nb)
    Of usr_xref, usr_dim, hds_fct
    WHERE usr_xref.sys_id = 'ACCESS '.
    AND usr_xref.usr_dim_nb = usr_dim.usr_dim_nb
    AND usr_dim.usr_dim_nb = hds_fct.usr_dim_nb
    AND hds_fct.pvlg_dim_nb <>0
    AND hds_fct.prod_dim_nb <>0
    AND hds_fct.cust_dim_nb <>0
    AND hds_fct.acct_dim_nb = 0) usr.
    FCST pvlg_dim,
    (SELECT prod_dim_nb, prod_type_nm, prod_fam_cd, prod_cd,
    prod_shrt_nm, prod_full_nm,
    LTRIM (SYS_CONNECT_BY_PATH (prod_cd, ' / '),)
    '/'
    ) product_hierarchy
    OF prod_dim
    WHERE prod_fam_cd = 'ATS '.
    START WITH prod_dim_nb = prnt_prod_dim_nb
    CONNECT BY NOCYCLE prnt_prod_dim_nb = PRIOR prod_dim_nb) prod
    WHERE usr.pvlg_dim_nb = pvlg.pvlg_dim_nb
    AND pvlg.prod_dim_nb = prod.prod_dim_nb;



    PLAN_TABLE_OUTPUT

    Hash value of plan: 3351127065

    -------------------------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    -------------------------------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 7. 15582 | 55 (6) | 00:00:01 |
    |* 1 | HASH JOIN | 7. 15582 | 55 (6) | 00:00:01 |
    |* 2 | HASH JOIN | 53. 6572. 52 (4) | 00:00:01 |
    | 3. VIEW | 53. 1325 | 44 (5) | 00:00:01 |
    | 4. UNIQUE HASH | 53. 2332 | 44 (5) | 00:00:01 |
    |* 5 | HASH JOIN | 53. 2332 | 43 (3) | 00:00:01 |
    |* 6 | TABLE ACCESS BY INDEX ROWID | HDS_FCT | 53. 1007 | 8 (0) | 00:00:01 |
    |* 7 | INDEX RANGE SCAN | HDS_FCT_FK3 | 55. 3 (0) | 00:00:01 |
    |* 8 | TABLE ACCESS FULL | USR_XREF | 346. 8650 | 34 (0) | 00:00:01 |
    | 9. TABLE ACCESS FULL | PVLG_DIM | 916. 90684 | 8 (0) | 00:00:01 |
    | 10. VIEW | 3. 6306 | 2 (0) | 00:00:01 |
    | * 11 | FILTER |
    | * 12 | CONNECT BY WITH FILTERING |
    | * 13 | TABLE ACCESS FULL | PROD_DIM | 1. 73. 3 (0) | 00:00:01 |
    | 14. NESTED LOOPS |
    | 15. CONNECT PUMP |
    | 16. TABLE ACCESS BY INDEX ROWID | PROD_DIM | 3. 219. 2 (0) | 00:00:01 |
    | * 17. INDEX RANGE SCAN | PROD_DIM_FK2 | 3 | | 1 (0) | 00:00:01 |
    -------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    1 - access("PVLG".") PROD_DIM_NB "=" PROD ". ("' PROD_DIM_NB")
    2 - access("USR".") PVLG_DIM_NB "=" FCST. ("' PVLG_DIM_NB")
    5 - access("HDS_FCT".") USR_DIM_NB "=" USR_XREF. " ("' USR_DIM_NB")
    6 - filter("HDS_FCT".") PROD_DIM_NB' <>0 AND 'HDS_FCT '. "' PVLG_DIM_NB ' <>0 AND
    'HDS_FCT '. ("' CUST_DIM_NB ' <>0)
    7 - access("HDS_FCT".") ACCT_DIM_NB "= 0)
    8 - filter("USR_XREF".") SYS_IDS "=" ACCESS")
    11 - filter ("PROD_FAM_CD" = 'ATS')
    12 - access ("PRNT_PROD_DIM_NB" = "PROD_DIM_NB" PRIOR)
    13 - filter ("PROD_DIM_NB" ="PRNT_PROD_DIM_NB")
    17 - access ("PRNT_PROD_DIM_NB" = "PROD_DIM_NB" PRIOR)




    Concerning
    REDA

    No, it's still not right. Please top and tail of your example with {code}

    Cheers, APC

    blog: http://radiofreetooting.blogspot.com

  • How to check the performance of query via the command sqlplus prompt

    Hello

    I work in the production environment, I want to check the performance of the queries in a production environment, we have no specific tools such as the expliin plan, TK Proff.

    I need chek performnce of sqlplus command line query

    Please let me know the process of query tuning of sqlplus command promt

    Here to explain plan:

    SQL> explain plan for
      2  select * from employees where employee_id = 170;
    
    Explained.
    
    SQL> select * from table(dbms_xplan.display());
    
    PLAN_TABLE_OUTPUT
    -----------------------------------------------------------------------------------------------
    Plan hash value: 1833546154
    
    ---------------------------------------------------------------------------------------------
    | Id  | Operation                   | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |               |     1 |    69 |     1   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| EMPLOYEES     |     1 |    69 |     1   (0)| 00:00:01 |
    |*  2 |   INDEX UNIQUE SCAN         | EMP_EMP_ID_PK |     1 |       |     0   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("EMPLOYEE_ID"=170)
    

    You can also use autotrace, which is super easy:

    SQL> set autotrace on
    SQL> select * from emp;
    
                   EMPNO ENAME      JOB                        MGR HIREDATE
    -------------------- ---------- --------- -------------------- --------------------
                    7369 SMITH      CLERK                     7902 17-DEC-1980 00:00:00
                    7499 ALLEN      SALESMAN                  7698 20-FEB-1981 00:00:00
                    7521 WARD       SALESMAN                  7698 22-FEB-1981 00:00:00
                    7566 JONES      MANAGER                   7839 02-APR-1981 00:00:00
                    7654 MARTIN     SALESMAN                  7698 28-SEP-1981 00:00:00
                    7698 BLAKE      MANAGER                   7839 01-MAY-1981 00:00:00
                    7782 CLARK      MANAGER                   7839 09-JUN-1981 00:00:00
                    7788 SCOTT      ANALYST                   7566 19-APR-1987 00:00:00
                    7839 KING       PRESIDENT                      17-NOV-1981 00:00:00
                    7844 TURNER     SALESMAN                  7698 08-SEP-1981 00:00:00
                    7876 ADAMS      CLERK                     7788 23-MAY-1987 00:00:00
                    7900 JAMES      CLERK                     7698 03-DEC-1981 00:00:00
                    7902 FORD       ANALYST                   7566 03-DEC-1981 00:00:00
                    7934 MILLER     CLERK                     7782 23-JAN-1982 00:00:00
    
    14 rows selected.
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3956160932
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |    14 |   532 |     3   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| EMP  |    14 |   532 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------
    
    Statistics
    ----------------------------------------------------------
            480  recursive calls
              0  db block gets
             92  consistent gets
              9  physical reads
              0  redo size
           1630  bytes sent via SQL*Net to client
            520  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              7  sorts (memory)
              0  sorts (disk)
             14  rows processed
    

    This guide has lots of good info:
    http://docs.Oracle.com/CD/B19306_01/server.102/b14211/TOC.htm

  • What is the query block?

    Hi guys,.

    I searched a lot on the "query block" on google, but dosent find any satisfactory article that will explain basic concept to me.

    I would like to know about the parameter query block that we specified when using indicators of query optimization in oracle.


    How can they be used? where we can find them?


    any suggestions?


    Thanks and greetings
    VD

    Vkrant,
    You did exactly the same thing that is asked of me all the time. What is the purpose of this indication in a simple query that I have to show you all the time. The answer is nothing, makes complex things however. But but but, in a very complex query, where there is a cross reference of the sections of different query is required, this trick will be useful to give a name to the underlying query.
    >
    Select / * + dept_id full (@qb d) QB_NAME (qb)
    of db.dept d;

    can we say its just alias?
    >
    Yes, any. Give an official name to the query. In this query, Department table will be available with FTS.
    HTH
    Aman...

Maybe you are looking for

  • After the update; my yahoo toolbar no longer works on FF?

    My media machine updated FF last week; my toolbar now displays only the email icon. About an hour; my main PC updated FF & right before my eyes my toolbar erased; except for the email link. I rely greatly on icons in my toolbar to navigate sites I us

  • Help! My computer keeps freezing upwards!

    My computer keeps freezing, what should I do?

  • Drivers for a windows 8 to 7 HP Pavilion TouchSmart 15-n006au

    Hey guys, any title. I got a Notepad of windows 8 to 7, managed to find the wireless driver, but usb 3.0, ethernet and chipset drivers win a game of hide and seek and seek gives me an ulcer. Any help would be appreciated =) See you soon

  • Blue Screen iaStor.exe. 0 x 00008086

    original title: BSOD iaStor.exe. 0 x 00008086 I tried to help a friend with their computer that constantly BSOD with the above error code.  Any suggestions as to what is the cause? This is a major problem? I can send files if necessary dmp. http://oj

  • Not able to ping inside the interface from outside

    Hello I'm trying to stimulate a new network like the diagram of the topology below: Topology However, I have a problem: ASA: I can ping to: 192.168.200.1 (Site_RTR IP, int fa0/1) 192.168.200.2 (ASA vlan interface IP, outside interface) 10.133.95.12 (