Indexing for a simple SQL

Hi guys,.

The below SQL is to do a full table scan.

SELECT AA, STATUS, CC, DD, FF, FF, GG, INCIDENT_ID

OF THE TEST

WHEN STATUS = 'F'

AND INCIDENT_ID = '15434';

1. After you have created an index on two columns STATUS and INCIDENT_ID, he did a scan of interval.

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
---------------------------------------------------

2 - access ("STATUS" = 'F' AND "INCIDENT_ID" = '15434')

2. I have delete the index and create again but this time on a single column INCIDENT_ID. It has the same behavior as the foregoing, do a scan of interval.

PLAN_TABLE_OUTPUT
-------------------------------------------
-------------------------------------------

1 - filter ("DELETE_IND" = 'F')
2 - access ("PAYMENT_DET_ID" = '15434')

The only different is the predicate as above.

Plan with the same cost, explain.

Therefore, can I create indexes only for incident_id? instead for 2 columns? What is actually recommended?

SELECT AA, STATUS, CC, DD, FF, FF, GG, INCIDENT_ID

OF THE TEST

WHEN STATUS = 'F'

AND INCIDENT_ID = '15434';

Thank you

Hello

(1) there seems to be an inconsistency in your message: you use STATUS/INCIDENT_ID in one case and DELETE_IND/PAYMENT_DET_ID in the other, it's confusing

(2) the difference between a single column and several (concatenated) column index here is quite simple. A multi-column index will match your completely predicate, that is, lines that meet the two conditions will return the INDEX RANGE SCAN. A single-column index will only select lines according to the requirement on the indexed column. So the question is, is quite good selectivity?

Let me give you an example: imagine that you have a table that describes the entire population of our planet, and you consider indexing columns COUNTRY_OF_ORIGIN and NATIVE_LANGUAGE. In this case, it is obvious that NATIVE_LANGUAGE does not provide any significant additional selectivity (as in most countries, there are only few languages), so a single-column index would suffice. If you consider a different pair of columns, for example COUNTRY_OF_ORIGIN and AGE, then combined selectivity is much stronger that the selectivity of each column only, so a concatenated index would be useful.

So all down to selectivity, namely, how to combine selectivity refers to the selectivity of single column.

Best regards

Nikolai

Tags: Database

Similar Questions

  • Output is not as expected (getting wrapped) for a simple sql script

    Hello

    I try to run a simple sql script with a few queries including a semi colon output (;) when text file separated that later - I can open in excel.

    My SQL file contains in part the code - below

    SELECT
    "PORTFOLIO" | « ; » ||
    "CONTRACT # | « ; » ||
    "CONS_INV #" | « ; » ||
    "CUSTOMER #" | « ; » ||
    "CLIENT_NAME | « ; » ||
    'MESSAGE ' | « ; » ||
    "REQUEST_ID" | « ; » ||
    "BILL_TO_COUNTRY" | « ; » ||
    "BILL_TO_ADDRESS1" | « ; » ||
    "BILL_TO_ADDRESS2" | « ; » ||
    "BILL_TO_ADDRESS3" | « ; » ||
    "BILL_TO_ADDRESS4" | « ; » ||
    "BILL_TO_CITY" | « ; » ||
    "BILL_TO_POSTAL_CODE" | « ; » ||
    "BILL_TO_STATE" | « ; » ||
    "BILL_TO_PROVINCE" | « ; » ||
    "BILL_TO_COUNTY" | « ; » ||
    "SHIP_TO_COUNTRY | « ; » ||
    "SHIP_TO_ADDRESS1" | « ; » ||
    "SHIP_TO_ADDRESS2" | « ; » ||
    "SHIP_TO_ADDRESS3" | « ; » ||
    "SHIP_TO_ADDRESS4" | « ; » ||
    "SHIP_TO_CITY" | « ; » ||
    "SHIP_TO_POSTAL_CODE" | « ; » ||
    "SHIP_TO_STATE | « ; » ||
    "SHIP_TO_PROVINCE" | « ; » ||
    "SHIP_TO_COUNTY" | « ; » ||
    "INVOICE_DATE | « ; » ||
    "INVOICE_CREATION_DATE" | « ; » ||
    "PARTIALLY_DROPPED" | « ; » ||
    "AMOUNT".
    OF the double
    /
    SELECT "DOUBLE
    /
    SELECT "error Code" | « ; » ||' Error message "OF the DOUBLE
    /

    SELECT lookup_code. « ; » || Description
    OF fnd_lookup_values
    WHERE lookup_type = 'CUST_ERROR. '
    /

    The issue I'm facing is that the output of the competitive program file comes out bit so enter each line only 132 characters in a line and therefore gets pushed in the next row in excel.

    Output-

    PORTFOLIO; CONTRACT #; CONS_INV #; CUSTOMER #; CLIENT_NAME; MESSAGE; REQUEST_ID; BILL_TO_COUNTRY; BILL_TO_ADDRESS1; BILL_TO_ADDRESS2; BILL_TO_A
    DDRESS3; BILL_TO_ADDRESS4; BILL_TO_CITY; BILL_TO_POSTAL_CODE; BILL_TO_STATE; BILL_TO_PROVINCE; BILL_TO_COUNTY; SHIP_TO_COUNTRY; SHIP_TO_ADDR
    ESS1; SHIP_TO_ADDRESS2; SHIP_TO_ADDRESS3; SHIP_TO_ADDRESS4; SHIP_TO_CITY; SHIP_TO_POSTAL_CODE; SHIP_TO_STATE; SHIP_TO_PROVINCE; SHIP_TO_COUN
    TY; INVOICE_DATE; INVOICE_CREATION_DATE; PARTIALLY_DROPPED; AMOUNT


    Please advice on all of the commands that I can use in the script sql in order to expand the output page or any other workaround solutions!
    Please answer as soon as possible if you can help me!

    Thank you!

    SQL * MORE?

    SQL> set lin 1000
    SQL> spool your_file_out.csv
    SQL> your_query
    SQL> spool off
    

    Kind regards
    Malakshinov Sayan

  • All parameter memory index for Oracle text indexes

    Hi Experts,

    I'm on Oracle 11.2.0.3 on Linux and have implemented Oracle Text. I'm not an expert in this area and need help on a question. I created the Oracle text index with the default setting. However, in a white paper of oracle, I read that the default setting is perhaps not good. Excerpt from the white paper by Roger Ford:

    URL:http://www.oracle.com/technetwork/database/enterprise-edition/index-maintenance-089308.html

    "(Part of this white paper below. )" ...)

    Index memory as mentioned above, $I entries cached emptied out on the disk each time the indexing memory is exhausted. The default index to installing memory is a simple 12MB, which is very low. At the time of creating indexes, users can specify up to 50 MB, but it is still quite low.                                   

    This would be by a CREATE INDEX, something like statement:

     CREATE INDEX myindex ON mytable(mycol) INDEXTYPE IS ctxsys.context PARAMETERS ('index memory 50M');  

    Allow index of the parameters of memory beyond 50 MB, the CTXSYS user must first of all increase the value of the MAX_INDEX_MEMORY parameter, like this:

     begin ctx_adm.set_parameter('max_index_memory', '500M'); end;  

    The parameter memory must never be high point causes paging, because this will have a serious effect on indexing speed. The smallest of dedicated systems, it is sometimes advantageous to temporarily reduce the amount of memory consumed by the Oracle SGA (for example by reducing DB_CACHE_SIZE and/or SHARED_POOL_SIZE) during the index creation process. Once the index has been created, the size of the SGA can be increased again to improve query performance. & quot;

    (End of the excerpt from the white paper)


    My question is:

    (1) to apply this procedure (ctx_adm.set_parameter) obliged me to log on as user CTXSYS. Is this fair? or can it be avoided and will be based on the application schema? The CTXSYS user is locked by default and I had to unlock it. Is this OK to do it in production?

    (2) what value I should use for the max_index_memory there are 500 MB - my SGA is 2 GB in Dev / QA and / 3 GB in the production. Also in the creation of the index which is the value should I set for the parameter memory index - I had left to default, but how do I change now? Should it be 50 MB as shown in the example above?

    (3) the white paper also refer to the reconstruction of an index to an interval like once a month: ALTER INDEX DR$ index_name$ X REBUILD online;

    -Is this good advice? I would like to ask the experts once before doing this.  We are on Oracle 11 g and the white paper was drafted in 2003.

    Basically, while I read the book, I'm still not clear on many aspects and need help to understand this.

    Thank you

    OrauserN

    Index entries are built in memory, and then flushed to disk, memory is exhausted. With a setting of high index memory will mean the index entries can be longer and less fragmented, which provides better performance of the query.  Conversely, a small memory parameter index will mean emptied the disk pieces are smaller, so queries (especially on common words) will have to do a lot more e/s to extract several pieces of index for the words.

  • ENQ: TX - index for cars running

    Hi all
    The system configuration is node 2 11 GR 2 cars used by 11.5.10.2 application ERP on RHEL 5

    Face claim to index to insert it on the big table with 27 million.
    We have solved this after purging of data to reduce the lines to 4 million and rebuild the index.
    I was against the approach to keep mind that the tree index B are self balanced do not rebuold

    I have presentation Joel and JLewis comments on this wait event
    Index stats before purge :
    
    SQL> select NAME,HEIGHT,BLOCKS,LF_ROWS,LF_BLKS ,LF_BLK_LEN,BR_BLKS,DISTI
    NCT_KEYS ,BTREE_SPACE,USED_SPACE ,PCT_USED  from index_stats;
    
    NAME                               HEIGHT     BLOCKS    LF_ROWS    LF_BLKS LF_BLK_LEN    BR_BLKS DISTINCT_KEYS BTREE_SPACE USED_SPACE   PCT_USED
    ------------------------------ ---------- ---------- ---------- ---------- ---------- ---------- ------------- ----------- ---------- ----------
    OE_PROCESSING_MSGS_TL_U1                3     151040   27108882     149878       4276        422      27108882   644266144  516301179         81
    
    
    Index stats After purge :
    
    
    SQL> select NAME,HEIGHT,BLOCKS,LF_ROWS,LF_BLKS ,LF_BLK_LEN,BR_BLKS,DISTINCT_KEYS ,BTREE_SPACE,USED_SPACE ,PCT_USED  from index_stats;
    
    
    NAME                               HEIGHT     BLOCKS    LF_ROWS    LF_BLKS LF_BLK_LEN    BR_BLKS DISTINCT_KEYS BTREE_SPACE USED_SPACE   PCT_USED
    ------------------------------ ---------- ---------- ---------- ---------- ---------- ---------- ------------- ----------- ---------- ----------
    OE_PROCESSING_MSGS_TL_U1                3      14816     4763902     14556    5644         34        4763902    82618912    90654959           110
    
    
    ASH data before data purge
    -----------------------
    
    Top User Events                   DB/Inst: PROD/PROD1  (Apr 04 12:00 to 13:00)
    
                                                                   Avg Active
    Event                               Event Class        % Event   Sessions
    ----------------------------------- --------------- ---------- ----------
    db file sequential read             User I/O             32.36       9.69
    read by other session               User I/O             19.43       5.82
    enq: TX - index contention          Concurrency          11.29       3.38
    enq: TX - row lock contention       Application          10.78       3.23
    CPU + Wait for CPU                  CPU                   7.32       2.19
              -------------------------------------------------------------
    
    
    
    Top Service/Module                DB/Inst: PROD/PROD1  (Apr 04 12:00 to 13:00)
    
    Service        Module                   % Activity Action               % Action
    -------------- ------------------------ ---------- ------------------ ----------
    PROD           NPIWIPLR                      23.90 Concurrent Request      23.90
                   OMRSVORD                       9.44 Concurrent Request       9.44
                   NPIIMGION                      8.65 Concurrent Request       8.65
                   OEOIMP                         4.53 Concurrent Request       4.53
                   OEXOEORD                       3.83 FRM:B82562:NPI Cus       1.09
              -------------------------------------------------------------
    
    
    Top User Events                   DB/Inst: PROD/PROD2  (Apr 04 12:00 to 13:00)
    
                                                                   Avg Active
    Event                               Event Class        % Event   Sessions
    ----------------------------------- --------------- ---------- ----------
    db file sequential read             User I/O             30.41       5.62
    CPU + Wait for CPU                  CPU                  22.40       4.14
    enq: TX - row lock contention       Application          13.71       2.53
    enq: TX - index contention          Concurrency           8.24       1.52
    read by other session               User I/O              7.80       1.44
              -------------------------------------------------------------
    
    Service        Module                   % Activity Action               % Action
    -------------- ------------------------ ---------- ------------------ ----------
    PROD           NPIWIPLR                      10.21 Concurrent Request      10.21
                   OEXOIMPT                       9.60 FRM:B60221:NPI Cus       4.31
                                                       FRM:N11217:NPI Cus       2.75
                                                       FRM:N13737:NPI Ord       2.54
                   OEXOEORD                       8.78 FRM:N11247:NPI Cus       3.80
                                                       FRM:C35809:NPI Cus       1.34
                                                       FRM:N11218:NPI Cus       1.20
                   NPIIMGION                      6.67 Concurrent Request       6.67
                   NPISLIM                        5.41 Concurrent Request       5.41
              -------------------------------------------------------------
    Questions

    (1) even if it seems he does not index unique sequence but the claim is there?
    (2) after reconstruction, we see pct_used > 110, what will happen?
    (3) prior use was 81 per cent, is higher and would lead to node splits for large indsddexes?

    Concerning
    KG

    KG says:

    Face claim to index to insert it on the big table with 27 million.
    We have solved this after purging of data to reduce the lines to 4 million and rebuild the index.
    I was against the approach to keep mind that the tree index B are self balanced do not rebuold

    First point to note - if you delete M 23 rows in a table with 27 million lines, it is probably a good idea to rebuild the table and the index to recover the space empty, unless you wait another 20 million lines to be arriviing soon and re-use of space very soon. In fact, you can use the dbms_redefinition package to extract the data you want to keep rather than a deletion. Alternatively you could actually marked as unused as an index on the table that you can get away with before to delete data and (optionally) make an area of narrowing.

    >

    Index before you purge statistics:

    SQL> select NAME,HEIGHT,BLOCKS,LF_ROWS,LF_BLKS ,LF_BLK_LEN,BR_BLKS,DISTI
    NCT_KEYS ,BTREE_SPACE,USED_SPACE ,PCT_USED  from index_stats;
    
    NAME                               HEIGHT     BLOCKS    LF_ROWS    LF_BLKS LF_BLK_LEN    BR_BLKS DISTINCT_KEYS BTREE_SPACE USED_SPACE   PCT_USED
    ------------------------------ ---------- ---------- ---------- ---------- ---------- ---------- ------------- ----------- ---------- ----------
    OE_PROCESSING_MSGS_TL_U1                3     151040   27108882     149878       4276        422      27108882   644266144  516301179         81
    
    Index stats After purge :
    
    SQL> select NAME,HEIGHT,BLOCKS,LF_ROWS,LF_BLKS ,LF_BLK_LEN,BR_BLKS,DISTINCT_KEYS ,BTREE_SPACE,USED_SPACE ,PCT_USED  from index_stats;
    
    NAME                               HEIGHT     BLOCKS    LF_ROWS    LF_BLKS LF_BLK_LEN    BR_BLKS DISTINCT_KEYS BTREE_SPACE USED_SPACE   PCT_USED
    ------------------------------ ---------- ---------- ---------- ---------- ---------- ---------- ------------- ----------- ---------- ----------
    OE_PROCESSING_MSGS_TL_U1                3      14816     4763902     14556    5644         34        4763902    82618912    90654959           110
    

    (1) even if it seems he does not index unique sequence but the claim is there?
    (2) after reconstruction, we see pct_used > 110, what will happen?
    (3) prior use was 81%, it is higher and would lead to node splits large index?

    One of the comments in one of the blogs I wrote on the index highlights a key problem: http://jonathanlewis.wordpress.com/2009/07/20/index-quiz-1/#comment-33897
    Note the LF_BLK_LEN in both cases: it is well below the 8000 bytes you get in general for an index btree, built in a block size of 8 KB. This is because the ITL list in some of the blocks sheet has grown to manage concurrent changes to the blocks, and the command ANALYZE took the biggest list ITL as typical of ALL blocks in the index. 110% and 81% are a side effect of this as Oracle took the used_space and the number of lf_blks * lf_blk_len to calculate the percenage: for example 90654959 / (5644 * 14556) = 1.1035

    You have created the index with a very large INITRANS, either a number of pads of sheets have already been under pressure concurrent insert and hit the "ITL Explosion" bug, losing a lot of inputs ITL which can not be recovered without some sort of index maintenance.

    You said that the index is not based on a sequence - but is it based on some form of monotonous increasing value (for example, a timestamp), you don't need a sequence to hit the problem you just need values that continue to increase. The problem is the number of basis 8767925 bug, fixed in paragraph 12.1 with backports available for some versions.

    Concerning
    Jonathan Lewis

  • Create indexes for an XMLType column.

    Hello

    I have a table that has a column of XMLType, the XSD is saved in DB. The XML is something like -

    < primary >
    < sub1 >
    < child1_1 / >
    < child1_2 / >
    < child1_3 / >
    < / sub1 >
    < sub2 >
    < child2_1 / >
    < child2_2 / >
    < child2_3 / >
    < / sub2 >
    < sub3 >
    < child31_1 / >
    < child3_2 / >
    < child3_3 / >
    < / sub3 >
    < / elementary school >

    I want to create indexes for child nodes. I read THAT XML structure cannot have collection as index it should be singleton.
    So can someone tell me no work around to create indexes for these nodes, or whatever it is that I missed as follows.

    Thank you

    #1. Since you're on 11g stop using the syntax of depricated... (extractValue, table (xmlsequence))

    SQL> create table PURCHASEORDER_TAB
      2  (
      3    PID number(4),
      4    PURCHASEORDER XMLTYPE
      5  )
      6  xmltype column PURCHASEORDER
      7  store as OBJECT RELATIONAL
      8  XMLSCHEMA "http://localhost:80/publishedContent/SB-XML/xsd/2010/purchaseOrder.xsd" Element "PurchaseOrder"
      9  /
    
    Table created.
    
    SQL> select table_name, table_type_name
      2  from user_nested_tables where parent_table_name = 'PURCHASEORDER_TAB';
    
    TABLE_NAME                     TABLE_TYPE_NAME
    ------------------------------ ------------------------------
    SYS_NTdmDOdAAMQsuXdRy6lc0H/A== Action64442_COLL
    SYS_NT8EIzAbUOQFGN2u6hCXP39g== LineItem64443_COLL
    
    SQL> rename "SYS_NT8EIzAbUOQFGN2u6hCXP39g==" to LINEITEM_NT
      2  /
    
    Table renamed.
    
    SQL> create index QTY_INDEX on LINEITEM_NT ("Quantity");
    
    Index created.
    
    SQL> set autotrace on explain lines 250 pages 50 trimspool on
    SQL> --
    SQL> select t.pid, quantity
      2    from PURCHASEORDER_TAB t,
      3         XMLTABLE
      4         (
      5           '/PurchaseOrder/LineItems/LineItem'
      6           passing t.PURCHASEORDER
      7           columns
      8           QUANTITY number(4) path 'Quantity'
      9         )
     10   where QUANTITY = 3
     11  /
    
    no rows selected
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1929272390
    
    --------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |                   |     1 |    46 |     3   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                |                   |       |       |            |          |
    |   2 |   NESTED LOOPS               |                   |     1 |    46 |     3   (0)| 00:00:01 |
    |*  3 |    TABLE ACCESS FULL         | LINEITEM_NT       |     1 |    23 |     2   (0)| 00:00:01 |
    |*  4 |    INDEX UNIQUE SCAN         | SYS_C00429284     |     1 |       |     0   (0)| 00:00:01 |
    |   5 |   TABLE ACCESS BY INDEX ROWID| PURCHASEORDER_TAB |     1 |    23 |     1   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - filter(CAST(TO_NUMBER(TO_CHAR("Quantity")) AS number(4) )=3)
       4 - access("NESTED_TABLE_ID"="T"."SYS_NC0002900030$")
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    SQL> select t.pid, quantity
      2    from PURCHASEORDER_TAB t,
      3         XMLTABLE
      4         (
      5           '/PurchaseOrder/LineItems/LineItem'
      6           passing t.PURCHASEORDER
      7           columns
      8           QUANTITY number(12,4) path 'Quantity'
      9         )
     10   where QUANTITY = 3
     11  /
    
    no rows selected
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3093486066
    
    --------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |                   |     1 |    46 |     2   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                |                   |       |       |            |          |
    |   2 |   NESTED LOOPS               |                   |     1 |    46 |     2   (0)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL         | PURCHASEORDER_TAB |     1 |    23 |     2   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN          | QTY_INDEX         |     1 |       |     0   (0)| 00:00:01 |
    |*  5 |   TABLE ACCESS BY INDEX ROWID| LINEITEM_NT       |     1 |    23 |     0   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - access("Quantity"=3)
       5 - filter("NESTED_TABLE_ID"="T"."SYS_NC0002900030$")
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    SQL> select t.pid, quantity
      2    from PURCHASEORDER_TAB t,
      3         XMLTABLE
      4         (
      5           '/PurchaseOrder/LineItems/LineItem'
      6           passing t.PURCHASEORDER
      7           columns
      8           QUANTITY path 'Quantity'
      9         )
     10   where QUANTITY = 3
     11  /
    
    no rows selected
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3093486066
    
    --------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |                   |     1 |    46 |     2   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                |                   |       |       |            |          |
    |   2 |   NESTED LOOPS               |                   |     1 |    46 |     2   (0)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL         | PURCHASEORDER_TAB |     1 |    23 |     2   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN          | QTY_INDEX         |     1 |       |     0   (0)| 00:00:01 |
    |*  5 |   TABLE ACCESS BY INDEX ROWID| LINEITEM_NT       |     1 |    23 |     0   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - access("Quantity"=3)
       5 - filter("NESTED_TABLE_ID"="T"."SYS_NC0002900030$")
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    SQL> SELECT t.pid, extractValue(Value(sta),'/LineItem/Quantity')
      2    FROM PURCHASEORDER_TAB t,
      3    table(xmlsequence(extract(t.purchaseOrder,'/PurchaseOrder/LineItems/LineItem'))) sta
      4    WHERE extractValue(Value(sta),'/LineItem/Quantity')= 3
      5  /
    
    no rows selected
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3093486066
    
    --------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |                   |     1 |    46 |     2   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                |                   |       |       |            |          |
    |   2 |   NESTED LOOPS               |                   |     1 |    46 |     2   (0)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL         | PURCHASEORDER_TAB |     1 |    23 |     2   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN          | QTY_INDEX         |     1 |       |     0   (0)| 00:00:01 |
    |*  5 |   TABLE ACCESS BY INDEX ROWID| LINEITEM_NT       |     1 |    23 |     0   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - access("Quantity"=3)
       5 - filter("NESTED_TABLE_ID"="T"."SYS_NC0002900030$")
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    SQL>
    

    Note the first example XMLTable does not use the index because the data type of AMOUNT is given wrong...

  • Read the index for performance data

    Hello.
    Advice needed.
    I have the table as
    create table test (a varchar2 (20), ch. varchar2 (20), b varchar2 (20), d...)

    I have indexes for the column "a".
    Now when I'm data select 1st three columns (a, b, c) by 'a' of the criteria (select a, b, c fom test where a like '% aa') I'll have the execution of plan:

    1 scan interval Index
    2. access by rowid

    Now, I want to choose without 2nd operation. So I'm adding complex index for a, b, c.
    After that this select (select a, b, c fom test where a like '% aa') will read the index data.

    The question: is it possible to win some perfomance win this way? I mean, it is possible that the research by complex index (a, b, c) will take longer than the search by simple index (a) + access by rowid?
  • How to make this simple sql run faster?

    Here is a very simple sql, but it takes too long to finish as an hour or more, and the problem is in the table. It's a huge table with 17660025 lines.
    In addition, upd_dt is indexed.
    select distinct (dstn_type) from ims_ets_prty_msge where ims_ets_prty_msge.upd_dt > sysdate - 30;
    Execution plan seems to be no problem: (is 9i, and I do not think that it would not perform better if the UNIQUE HASH is used instead of SORT UNIQUE)
    -----------------------------------------------------------------------------------------
    | Id  | Operation                    |  Name                    | Rows  | Bytes | Cost  |
    -----------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |                          |     6 |    78 |  1409 |
    |   1 |  SORT UNIQUE                 |                          |     6 |    78 |  1409 |
    |   2 |   TABLE ACCESS BY INDEX ROWID| IMS_ETS_PRTY_MSGE        |   856K|    10M|    10 |
    |*  3 |    INDEX RANGE SCAN          | IMS_ETS_PRTY_MSGE_INDX5  |   154K|       |     2 |
    -----------------------------------------------------------------------------------------
     
    Predicate Information (identified by operation id):
    ---------------------------------------------------
     
       3 - access("IMS_ETS_PRTY_MSGE"."UPD_DT">SYSDATE@!-30)
     
    Note: cpu costing is off
    Here is some info on the table
    NUM_ROWS BLOCKS  EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN
    17129540      455259     622           502             455278      188
    The thing is that we must make it run faster.
    And all I can think is to create a bitmap on dstn_type (low cardinality) index and partition the table using upd_dt;

    So my question would be is anyway that we can get a better response time without having to make that kind of change?
    Or is this kind of change really help?

    Any thoughts would be appreciated!

    Thank you

    Have you thought about putting an index on (upd_dt, dstn_type)?

    With the query you posted, and this index, it should be possible to use a full scan of the index, no visit to the table at all.

    A bitmap index would not be a good idea, if it is an OLTP application / table.

  • Type of index for VarChar2

    Hello

    I have a number of varchar2 fields on my paintings. They are VarChar2 (2000) with an average length between 130 and 290 characters.
    I would like to build the index for these fields to improve search performance.
    It is on an instance of Oracle9.

    Could you recommend a type of index for this field?

    Thank you

    Death :)

    Pavan - a DBA wrote:
    According to Oracle,.
    If this column contains the low cardinality (less), you can create bitmap indexes
    If this column contains the high cardinality (more), you can create the index b-tree (default index type)

    It is not so simple.
    Please read the following thread, it contains also some interesting links:
    Re: index bitmap and distinct keys

    Nicolas.

  • Is there a way to get a 'default' DataTemplate based on a simple sql query?

    Hi all

    I wonder if there is a way to produce a default value of the DataTemplate (or at least the dataStructure of the model portion).

    I like to call a trigger beforeReport to fill in the data for the report as such, I have to use dataTemplate instead of a simple SQL query, "select * from table_name". I have more than 50 columns on the report so I was hoping that I could not manually built a dataTemplate (or at less the part of dataStructure) for each report just be able to call a trigger.

    Thanks in advance for your ideas.
    Kind regards
    Yahya

    You need not define the cases you need the xml structure to be automatically decided by BEEP.

    
         
              
              
         
         
              
                   
              
         
    
    

    This datatemplate allows you to get the following structure

    
    
    
    
    
    ..
    ..
    
    
    
    
    ..
    ..
    
    
    
    
    ..
    ..
    
    
    
    
    ..
    ..
    
    
    /LIST_ROW>
    
    
  • Plans of multiple executions for the same SQL statement

    Dear experts,

    awrsqrpt. SQL shows several plans for a single SQL statement executions. How is it possible that a single SQL statement will be several Plans of executions within the AWR report.

    Here is the output of the awrsqrpt for your reference.

    WORKLOAD REPOSITORY SQL Report
    
    Snapshot Period Summary
    
    DB Name         DB Id    Instance     Inst Num Release     RAC Host
    ------------ ----------- ------------ -------- ----------- --- ------------
    TESTDB          2157605839 TESTDB1               1 10.2.0.3.0  YES testhost1
    
                  Snap Id      Snap Time      Sessions Curs/Sess
                --------- ------------------- -------- ---------
    Begin Snap:     32541 11-Oct-08 21:00:13       248     141.1
      End Snap:     32542 11-Oct-08 21:15:06       245     143.4
       Elapsed:               14.88 (mins)
       DB Time:               12.18 (mins)
    
    SQL Summary                            DB/Inst: TESTDB/TESTDB1  Snaps: 32541-32542
    
                    Elapsed
       SQL Id      Time (ms)
    ------------- ----------
    51szt7b736bmg     25,131
    Module: SQL*Plus
    UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(ACCT_DR_BAL,
    0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND TEST_ACC_NB = ACCT_ACC_NB(+)) WHERE
     TEST_BATCH_DT = (:B1 )
    
              -------------------------------------------------------------
    
    SQL ID: 51szt7b736bmg                  DB/Inst: TESTDB/TESTDB1  Snaps: 32541-32542
    -> 1st Capture and Last Capture Snap IDs
       refer to Snapshot IDs witin the snapshot range
    -> UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(AC...
    
        Plan Hash           Total Elapsed                 1st Capture   Last Capture
    #   Value                    Time(ms)    Executions       Snap ID        Snap ID
    --- ---------------- ---------------- ------------- ------------- --------------
    1   2960830398                 25,131             1         32542          32542
    2   3834848140                      0             0         32542          32542
              -------------------------------------------------------------
    
    
    Plan 1(PHV: 2960830398)
    -----------------------
    
    Plan Statistics                        DB/Inst: TESTDB/TESTDB1  Snaps: 32541-32542
    -> % Total DB Time is the Elapsed Time of the SQL statement divided
       into the Total Database Time multiplied by 100
    
    Stat Name                                Statement   Per Execution % Snap
    ---------------------------------------- ---------- -------------- -------
    Elapsed Time (ms)                            25,131       25,130.7     3.4
    CPU Time (ms)                                23,270       23,270.2     3.9
    Executions                                        1            N/A     N/A
    Buffer Gets                               2,626,166    2,626,166.0    14.6
    Disk Reads                                      305          305.0     0.3
    Parse Calls                                       1            1.0     0.0
    Rows                                        371,735      371,735.0     N/A
    User I/O Wait Time (ms)                         564            N/A     N/A
    Cluster Wait Time (ms)                            0            N/A     N/A
    Application Wait Time (ms)                        0            N/A     N/A
    Concurrency Wait Time (ms)                        0            N/A     N/A
    Invalidations                                     0            N/A     N/A
    Version Count                                     2            N/A     N/A
    Sharable Mem(KB)                                 26            N/A     N/A
              -------------------------------------------------------------
    
    Execution Plan
    ------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------------------------
    |   0 | UPDATE STATEMENT             |                 |       |       |  1110 (100)|          |
    |   1 |  UPDATE                      | TEST            |       |       |            |          |
    |   2 |   TABLE ACCESS FULL          | TEST            |   116K|  2740K|  1110   (2)| 00:00:14 |
    |   3 |   TABLE ACCESS BY INDEX ROWID| ACCT            |     1 |    26 |     5   (0)| 00:00:01 |
    |   4 |    INDEX RANGE SCAN          | ACCT_DT_ACC_IDX |     1 |       |     4   (0)| 00:00:01 |
    ------------------------------------------------------------------------------------------------
    
    
    
    
    Plan 2(PHV: 3834848140)
    -----------------------
    
    Plan Statistics                        DB/Inst: TESTDB/TESTDB1  Snaps: 32541-32542
    -> % Total DB Time is the Elapsed Time of the SQL statement divided
       into the Total Database Time multiplied by 100
    
    Stat Name                                Statement   Per Execution % Snap
    ---------------------------------------- ---------- -------------- -------
    Elapsed Time (ms)                                 0            N/A     0.0
    CPU Time (ms)                                     0            N/A     0.0
    Executions                                        0            N/A     N/A
    Buffer Gets                                       0            N/A     0.0
    Disk Reads                                        0            N/A     0.0
    Parse Calls                                       0            N/A     0.0
    Rows                                              0            N/A     N/A
    User I/O Wait Time (ms)                           0            N/A     N/A
    Cluster Wait Time (ms)                            0            N/A     N/A
    Application Wait Time (ms)                        0            N/A     N/A
    Concurrency Wait Time (ms)                        0            N/A     N/A
    Invalidations                                     0            N/A     N/A
    Version Count                                     2            N/A     N/A
    Sharable Mem(KB)                                 26            N/A     N/A
              -------------------------------------------------------------
    
    Execution Plan
    ---------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name         | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------------
    |   0 | UPDATE STATEMENT             |              |       |       |     2 (100)|          |
    |   1 |  UPDATE                      | TEST         |       |       |            |          |
    |   2 |   TABLE ACCESS BY INDEX ROWID| TEST         |     1 |    28 |     2   (0)| 00:00:01 |
    |   3 |    INDEX RANGE SCAN          | TEST_DT_IND  |     1 |       |     1   (0)| 00:00:01 |
    |   4 |   TABLE ACCESS BY INDEX ROWID| ACCT         |     1 |    26 |     4   (0)| 00:00:01 |
    |   5 |    INDEX RANGE SCAN          | INDX_ACCT_DT |     1 |       |     3   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------
    
    
    
    Full SQL Text
    
    SQL ID       SQL Text
    ------------ -----------------------------------------------------------------
    51szt7b736bm UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL, 0) +
                  NVL(ACCT_DR_BAL, 0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND PB
                 RN_ACC_NB = ACCT_ACC_NB(+)) WHERE TEST_BATCH_DT = (:B1 )
    Your contribution is very much appreciated.

    Thank you for taking your time to answer my question.


    Concerning

    Oracle Lover3 wrote:
    How will I know (from Plan 1 and Plan 2) whose execution plan chose for the current run?

    Since you're already on 10.2, you can identify the actual execution plan by checking in V$ SESSION SQL_ID and SQL_CHILD_NUMBER column. This can be used to identify the plan in V$ SQL_PLAN (columns SQL_ID and CHILD_NUMBER) and in 10g, you can use the convenient DBMS_XPLAN. Function DISPLAY_CURSOR for the information of the real plan using these two parameters.

    Kind regards
    Randolf

    Oracle related blog stuff:
    http://Oracle-Randolf.blogspot.com/

    SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676 /.
    http://sourceforge.NET/projects/SQLT-pp/

  • Why is there not an option to create a custom for a simple telephone touch label?

    Why is there not an option to create a custom for a simple telephone touch label? 9. new version of iOS.

    There are. What makes you think there isn't. When you click to add a phone number, click label, and then scroll down to Custom. Type away.

  • Driver missing for PCI Simple Communications Controller for U41

    I have a problem with a driver for PCI Simple Communications Controller for U41. Please help for the best solution thanks

    Good day and welcome to the community.

    This is usually resolved by installing the Intel Management Engine Interface package.

    Please take a look at the pages of resources of your machine, under the section of Chipset :

    http://support.Lenovo.com/us/en/products/laptops-and-netbooks/u-series/U41-70

    I don't know if there are also the Serial i/o package.

    I hope this helps a little.

    Kind regards.

  • You are looking for a SIMPLE, EASY to USE, USB flash drive password protection

    Hello everyone,

    I scoured the Internet looking for a SIMPLE, EASY to USE, method of Word to PASS-PROTECT my flash drives TOGETHER.  I don't mean something that protects just individual files & folders (such as MS Word, Excel & can do).  Or I'm looking for a program that involves having to read page after page of instructions on how to ENCRYPT the drive.  ENCRYPTION is a topic that is really beyond my ability to understand.  I'm sorry.

    Programs like Truecrypt, Axcrypt, etc. are simply much too complicated for me to understand... a lot less!

    My question: are there flash drives available (size 8-16 GB preferably) who have a means of securing the disk with a password?

    The USB key remains in my USB port at ALL times!  I have no other computers here and live alone, so that no one else could access the flash player (or computer).  Otherwise, I would be willing to consider a VERY SIMPLE, EASY to UNDERSTAND AND USE application, either free or something that does not cost me dearly.  (I subsist on a limited monthly disability income).

    Thank you for your time and any recommendations!

    It seems that the solution for you would be to purchase a secure Flash drive.   Security is built-in and it asks for your password when you insert your disc into the computer.   Can't get much simpler than that.  They are a little more expensive, but you pay more for practical reasons.   See the following article:
    'USB Flash Drive Security '.
       <>http://en.Wikipedia.org/wiki/USB_flash_drive_security >
    To find one, just Google for "Secure USB flash drive", there are a lot of them out there.

    If you have a non-secure flash drive and do not want to replace, then your easiest option would be a program like Truecrypt which you already have reduced as being too complicated.  Don't let the word"encryption" you scared - it all comes down to "enter a password to access".»  Once established, however, it is almost as simple as only to enter a password so if you can find a computer or a local high school computer nerd literate member of the family who would volunteer to set up for you, then it wouldn't be that hard.

    HTH,
    JW

  • How to print an index for a directory?

    original title: print the directory

    How to print an index for a directory?  At home I run Windows 7, but I really want to do this at work - OS is Vista Business

    You mean "how to print a list of the directories?
    http://www.Google.com/search?q=how+do+I+print+a+directory+listing

    How to add the feature print directory for files in Windows XP, Windows Vista, in Windows 7
    http://support.Microsoft.com/kb/321379

    HTH

  • Parse Hard &amp; Soft Parse for a given SQL?

    Hi all

    I need to know which of these is a hard and soft analysis for a given Sql. What I think is the 'charges' and 'invalidation' indicates if a cursor is invalidated and gets reloaded, which allows us to check if a call analysis becomes hard analysis.

    Confusion here is should "Disk reads" value nonzero means hard analysis regardless of the 'load' and 'invalidation' and 'Disc bed' zero value means soft parse?

    SELECT a.SQL_ID, a.INSTANCE_NUMBER, a.SNAP_ID,
      TO_CHAR(b.END_INTERVAL_TIME, 'DD-MON-YYYY HH24:MI') snap_time,
      a.PLAN_HASH_VALUE,
            ROUND(a.ELAPSED_TIME_DELTA/1000000) TOTAL_EXECUTION_TIME_SEC,
            ROUND(a.CPU_TIME_DELTA/1000000)    cpu_seconds,
            a.ROWS_PROCESSED_DELTA    rows_processed,
            a.BUFFER_GETS_DELTA      buffer_gets,
            a.DISK_READS_DELTA      disk_reads,
            a.EXECUTIONS_DELTA      executions,
            a.PARSE_CALLS_DELTA    parses,
      a.VERSION_COUNT             version_count,
            a.LOADS_TOTAL               loads_total,
            a.INVALIDATIONS_TOTAL       invalidations_total
    FROM DBA_HIST_SQLSTAT a, DBA_HIST_SNAPSHOT b
    WHERE a.SNAP_ID = b.SNAP_ID and a.INSTANCE_NUMBER=b.INSTANCE_NUMBER
    AND a.INSTANCE_NUMBER=1 AND a.SQL_ID='bsraj0u9r9d3w'
    ORDER BY a.SNAP_ID desc;
    
                                                                 TOTAL
                  Instance      Snap Snap                    EXECUTION     CPU                    Buffer     Disk                   version loads invalidations
    Sql Id          Number        Id Time                    TIME(Sec) Seconds     Rows             Gets    Reads Executions Parses   count total         total
    ------------- -------- --------- -------------------- ------------ ------- -------- ---------------- -------- ---------- ------ ------- ----- -------------
    bsraj0u9r9d3w        1      9368 12-FEB-2016 12:00              14      13      200       14,079,211      780          2      1       1     6             5 --- hard Parse
    bsraj0u9r9d3w        1      9348 11-FEB-2016 16:00             110      91    1,500      104,806,435        0         15      4       1     5             4 --- ??
    bsraj0u9r9d3w        1      9347 11-FEB-2016 15:00              30      29      500       34,922,061        0          5      2       1     5             4 --- ??
    bsraj0u9r9d3w        1      9346 11-FEB-2016 14:00              14      13      200       14,009,248        0          2      1       1     5             4 --- ??
    bsraj0u9r9d3w        1      9341 11-FEB-2016 09:00              14      13      200       14,009,957      651          2      2       1     5             4 --- hard Parse
    bsraj0u9r9d3w        1      9297 09-FEB-2016 13:00              20      20      500       23,380,631        0          5      4       1     4             3 --- ??
    bsraj0u9r9d3w        1      9294 09-FEB-2016 10:00              65      53    1,300       58,569,220        0         13     13       1     3             2 --- ??
    bsraj0u9r9d3w        1      9293 09-FEB-2016 09:00              18      17      300       18,635,057        0          3      2       1     3             2 --- ??
    bsraj0u9r9d3w        1      9292 09-FEB-2016 08:00              70      67    1,700       77,145,560      787         17     17       1     3             2 --- hard Parse
    bsraj0u9r9d3w        1      9272 08-FEB-2016 12:00              18      18      400       22,164,178        0          4      4       1     2             1 --- ??
    bsraj0u9r9d3w        1      9270 08-FEB-2016 10:00             106     101    2,500      123,154,635        0         26     24       1     2             1 --- ??
    bsraj0u9r9d3w        1      9269 08-FEB-2016 09:00              11      10      300       11,401,899      657          3      3       1     2             1 --- hard Parse
    bsraj0u9r9d3w        1      9253 07-FEB-2016 17:00             104      98    2,300      115,320,927      788         23     23       1     1             0 --- hard Parse
    

    Thanks in advance

    Reads disk do not mean that the query will invalidation thus analyze hard. Reading disc mean simply that the IO that happens from disk and it is perhaps due to the result not being not not available in memory.

    I'm not sure why you use this type of analysis to check if requests are going for hard analysis or not? Why not pick up a particular query run and use TKPROF(better SQLTXPLAN) or AWR based SQRPT.sql to check the same? What is the exact issuethat, you're trying to solve?

    Aman...

Maybe you are looking for

  • MY button "List all tabs" disappeared, how do I get that back?

    I used to have a small arrow in the top right corner of my screen called 'list all tabs' when I clicked it, it gave me a drop down of all my open tabs. Somehow he disappeared and I do not know how to retrieveI tried to go in customize, but could not

  • I can't attach a large excel file with firefox. in an e-mail.

    I often attach files to send, but this file of particles will not focus.

  • Recovery for M200 DVDs

    It seems that the recovery for the M200 DVDs is not complete. I can't start it using an external DVD so followed the procedure of the Portege 3500 in support for http://tinyurl.com/7465q newsletter It started from a floppy and allowed me to view the

  • Bad screen refresh rate shown under Vista - Satellite P100-429

    Hello I have a Satellite P100-429. There are three weak, I install Windows Vista Ultimate Edition, but now the highest of screen refresh rate is 60 Hz. I tried to download the latest drivers for the graphics card, but this will not work and the compu

  • DPP 4 cut and reframe the Question to the tool

    When using DPP 4 setting / Crop tool I can't paste changes to multiple images. When you use the old version of DPP 3, there is a button "apply to all". It was a very useful feature. I hope that it has not been removed in the latest version of the sof