Which index to use?

I have a table containing large complete 2D polygons (State and county boundaries). Each row in the table represents an entire polygon rather than a linestring section of a polygon.
There are a large number of vertices in each polygon - some rows have over 100,000 entries in the SDO_ORDINATE_ARRAY.
What sort of index should I use to maximise the performance?
I am currently using Fixed Tile Quadtree indexing with an SDO_LEVEL of 6.
Would R-Tree or Hybrid indexing suit such a geometry better?

Hi,
It depends on which version of Oracle Spatial you are using.
As of Oracle 9i, the recommendation is to use R-tree indexes (they are easy to
create, there is no tuning, their performance is nearly always as good or better
than quadtree indexes, they can be geodetic, there is functionality only supported
when using R-tree indexes). There are still a few cases where quadtrees have
better performance, but R-tree indexes are getting better all the time.
In earlier versions, there are a lot of cases where quadtrees are better suited to do some
kinds of queries.
Oracle doesn't recommend using hybrid quadtree indexes.
If you are having performance problems, you might want to use spatial index advisor
to help you determine a good indexing level for a quadtree index.

Similar Messages

  • How to know , that an index is used in query in the program

    Hi All
    I have found a SELECT query within a program , which needs to be tuned. I need to justify client of my change. He wants to know how many indexes are there used in the select , as well as which indexes are partially used and how we can optimize use of indexes,
    I did an trace analysis of program using ST05, however I am not getting to know which index is used in this trace analysis.
    I need help on these points from you all.
    Thanks in Advance
    Amol

    Hi
    After clicking DDIC information
    I am getting 3 buttons on the top, and below I am getting
    Overview of View WB2_V_MKPF_MSEG2
    Obj. name                   WB2_V_MKPF_MSEG2
    SQL Object                  WB2_V_MKPF_MSEG2
    Table Type                  VIEW
    Buffering                   Buffering not allowed
    Short Text                  Data Selection from Material Documents (without WBGT)
    Classification                         Other
                                           Other
                                           Trading Execution Workbench
    Author                      SAP
    Last Changed By             Not Found
    NametabRec.Length                 2436 Byte
    Last DB Analysis            00/00/0000
      No. of records                     0
    All Table Indexes of View                WB2_V_MKPF_MSEG2
      Name   Description                                                    Created by     Unique
      Indexes of  MKPF
      0      Primary key                                                    SAP            X
      BUD    Index for posting date                                         SAP
      Y      Fiscal Year, Posting date and Doc. number                      AJOSHI
      Indexes of  MSEG
      0      Primary key                                                    SAP            X
      M      Material documents for material                                SAP
      R      Material docs for reservation                                  SAP
      S      Reversal documents for mat. document                           SAP
    However from above I am not getting which index is being used or not. OR which is used fully or partially .. like that,
    I need to know these details
    Thanks in Advance
    Amol

  • Hi. I am building a website with the White template. Does anyone know which typeface was used by Apple on the heading index? (I would like to repeat the index at the bottom of my pages).

    Hi I am building a website using iWeb's white template. I can't write HTML, so can't change the index, but would like to repeat it at the bottom of my pages. Does anyone know which typeface Apple used? Presumably it would be 'web friendly' for use as described above?

    Arial
    PS. You can see it in the source of the published page where it says new NavBar etc...
    ".navbar {\n\tfont-family: Arial, sans-serif;\n\tfont-size: 1em;\n\tcolor: #666;\

  • How to tell which Indexes are not being used?

    We are a large development shop and have many customers. Our database design is very generic so that it works for all of our customers. Each night we use an SSIS ETL process to bring down large amounts of data from the iSeries into SQL. One
    particularily large customer takes a very long time and we are looking for ways to speed up thier data import and transformation. I would like to see which indexes he does not use and possibly remove them. Each night we fully repopulate hundreds of staging
    and ods tables and incrementally delete and repopulate the days work for a handful of history type tables. Removing some indexes off of the large tables could make a big impact. 
    How can i tell which indexes the customer does not use?

    > IDENTIFYING UNUSED INDEXES IN A SQL SERVER DATABASE 
       Just because an index is not being used does not necessarily mean it should be removed.
    > Index This: All About SQL Server Indexes
    sp_BlitzIndex
    José Diz     Belo Horizonte, MG - Brasil

  • How can i know which index will be used when executing the query ?

    1 ) I have query in which i have 3-4 tables but there multiple index on one column .
    so how can i know which index will be used when executing the query ?
    2) I have a query which ia taking too much time . how can i know which table is taking too much time ?
    3) Please Provide me some document of EXplain plan ?

    Hi Jimmy,
    Consider the below example
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    CREATE TABLE FIRST AS
    SELECT * FROM all_objects;
    UPDATE FIRST
    SET object_name = 'TEST'
    WHERE owner != 'SCOTT';
    CREATE INDEX idx_first ON FIRST(object_name);
    SELECT *
    FROM FIRST
    WHERE object_name = 'TEST';
    It has not used index
    Execution Plan
    Plan hash value: 2265626682
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 58678 | 7334K| 163 (4)| 00:00:02 |
    |* 1 | TABLE ACCESS FULL| FIRST | 58678 | 7334K| 163 (4)| 00:00:02 |
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    SELECT *
    FROM FIRST
    WHERE object_name = 'emp';
    This has used the index
    Execution Plan
    Plan hash value: 1184810458
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 128 | 1 (0)| 00:00:01 |
    | 1 | TABLE ACCESS BY INDEX ROWID| FIRST | 1 | 128 | 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | IDX_FIRST | 1 | | 1 (0)| 00:00:01 |
    From this we can come to the conclusion that, whether to use one index or not by oracle
    would also depend on the data which is present in the table. This has to be this way as
    we see in the bind peeking, if oracle sticks to only one plan, say only use the full table
    scan, it would be a performance hit when it searches for the second query ie where object_name
    ='emp';
    2.
    If we have a query like below.
    select * from emp
    where upper(ename) = upper(:p_ename);
    Evenif we have the index on ename column, oracle wouldn't be able to use the index, as there is a function in the predicate column. If you need oracle to use the index, we need to create a function based index as below.
    Create index idx_ename on emp(upper(ename));
    Regards,
    Cool

  • TREX Active Index - Which index is really being used?

    We are using ISA E-Commerce 5.0 for ERP 6.0. We run the ISA_CATALOG_REPLICATION program as an hourly job to create indexes in TREX. We add items to our catalog several times a day. Our variant is set to keep 5 indexes.
    1. Where do I verify which index is REALLY active? They are all green in TREX Admin and they all have an Active flag in SRMO. (I am pretty certain the older indexes are not being used by ISA because the new items show up in B2B after the ISA_CATALOG_REPLICATION completes)
    2. When the ISA_CATALOG_REPLICATION cancels due to an SRET error, I want to go back to the last valid index in TREX and force the system to use that index. How do I do that?
    Thank you
    Jon Sells

    SAP told that this functionality is not available in TREX. So there really is no point in having more than 1 index at a time.

  • How to check which function was used in a function based index.

    Hi how can i check which function was used in a function based index created on a column.
    Thanks

    Hi,
    What is your requirement... !!
    Bascially performing a function on an indexed column in the where clause of a query guaranteed an index would not be used. From Oracle 8i onwards introduced Function Based Indexes to counter this problem.
    Any how check this..you will get an idea..
    http://www.akadia.com/services/ora_function_based_index_2.htm
    http://www.oracle-base.com/articles/8i/FunctionBasedIndexes.php
    -Pavan Kumar N

  • Which type of index is useful for date columns with time stamp

    Hi all,
    I am using date column in the where clause of an SQL Query. The values stored in the date column are includes timestamp. The query is very slow and there is no index on the date column.
    Can any body suggest which index is better on date columns
    Thanks

    I am using date column in the where clause of an SQL Query.Dates a re hard queries to tune. This ...
    WHERE start_date BETWEEN to_date('01-SEP-05') AND to_date('02-SEP-05')...probably requires a very different execution plan to this...
    WHERE start_date BETWEEN to_date('01-JAN-01') AND to_date('02-SEP-05')Just bunging an index on the date column may speed up your specific query but break something else. So be careful.
    Cheers, APC

  • How to find which queries is using which indexes

    So, I have a db 11gr2 and many indexes. Since I would like to delete some of them, I could see which indexes are unused, but I would like to see if some of indexes are used ony by one or two queries...
    how could I found that?

    If you have license for AWR views, use the below sql to identify indexes used.
    This script has following bind variable
    a1: owner
    a and b: begin and end of snapshot
    a2: tablespace name where your index exists
    As suggested in this thread, do not plan to drop Foriegn key indexes if they are not listed.
    col object_name for a30
    col tablespace_anme fora 12
    col count for 9999
    col operation for a35
    col options for a25
    set lines 160
    select c.*, d.tablespace_name
    from (select
    a.object_name ,
    a.operation ,
    a.options ,
    count(1)
    from
    dba_hist_sql_plan a,
    dba_hist_sqlstat b
    where
    a.object_owner ='&a1'
    and
    a.operation like '%INDEX%'
    and
    a.sql_id = b.sql_id
    and b.snap_id between &a and &b
    group by
    a.object_name,
    a.operation,
    a.options
    order by
    4 desc) c,
    dba_segments d
    where c.object_name=d.segment_name
    and d.tablespace_name='&a2'

  • How to find which user is using the index?

    Hi All,
    I have an index named 'CTXT_ITEM_CODE' . The Index _type is Domain. When i try to drop this index its telling ORA-00054: resource busy and acquire with NOWAIT specified error
    now i need to find out which session is using this index, so that i can kill it and drop the index.
    Thanks

    SELECT c.owner,
           c.object_name,
           c.object_type,
           b.SID,
           b.serial#,
           b.status,
           b.osuser,
           b.machine
      FROM v$locked_object a, v$session b, dba_objects c
    WHERE b.SID = a.session_id AND a.object_id = c.object_id
    AND c.object_name='CTXT_ITEM_CODE';
    ALTER SYSTEM KILL SESSION '<sid, serial#>'

  • Which license to use ?

    When installing 11G XE beta on Windows following license is displayed:
    >
    Oracle Technology Network Early Adopter License Terms
    Export Controls on the Programs
    Selecting the "Accept License Agreement" button is a confirmation of your agreement that you comply, now and during the trial term, with each of the following statements:
    -You are not a citizen, national, or resident of, and are not under control of, the government of Cuba, Iran, Sudan, North Korea, Syria, nor any country subject to United States trade sanctions.
    -You will not download, provide, make available or otherwise export or re-export the Programs, directly or indirectly, to the above mentioned countries nor to citizens, nationals or residents of those countries, wherever located.
    -You are not listed on the United States Department of Treasury lists of Specially Designated Nationals and Blocked Persons, Specially Designated Terrorists, and Specially Designated Narcotic Traffickers, nor are you listed on the United States Department of Commerce Table of Denial Orders.
    You will not download or otherwise export or re-export the Programs, directly or indirectly, to persons on the above mentioned lists.
    You will not use the Programs for, and will not allow the Programs to be used for, any purposes prohibited by United States law, including, without limitation, for the development, design, manufacture or production of nuclear, chemical or biological weapons of mass destruction.
    EXPORT RESTRICTIONS
    You agree that U.S. export control laws and other applicable export and import laws govern your use of the programs, including technical data; additional information can be found on Oracle®'s Global Trade Compliance web site (http://www.oracle.com/products/export).
    You agree that neither the programs nor any direct product thereof will be exported, directly, or indirectly, in violation of these laws, or will be used for any purpose prohibited by these laws including, without limitation, nuclear, chemical, or biological weapons proliferation.
    Oracle Employees: Under no circumstances are Oracle Employees authorized to download software for the purpose of distributing it to customers. Oracle products are available to employees for internal use or demonstration purposes only. In keeping with Oracle's trade compliance obligations under U.S. and applicable multilateral law, failure to comply with this policy could result in disciplinary action up to and including termination.
    Note: You are bound by the Oracle Technology Network ("OTN") License Agreement terms. The OTN License Agreement terms also apply to all updates you receive under your Technology Track subscription.
    The OTN License Agreement terms below supercede any shrinkwrap license on the OTN Technology Track software CDs and previous OTN License terms (including the Oracle Program License as modified by the OTN Program Use Certificate).
    Oracle Technology Network Development License Agreement
    "We," "us," and "our" refers to Oracle America, Inc., for and on behalf of itself and its subsidiaries and affiliates under common control. "You" and "your" refers to the individual or entity that wishes to use the programs from Oracle. "Programs" refers to the pre-production release version of the Oracle software product you wish to download and use and program documentation, if any. "License" refers to your right to use the programs under the terms of this agreement. "Confidential Information" includes (a) the Programs and all information related thereto, including but not limited to features, requirements, designs, specifications and documentation; and (b) any other information disclosed by Oracle hereunder and marked or identified as confidential at the time of disclosure. Confidential Information does not include information which (a) is or becomes a part of the public domain through no act or omission of you; or (b) was in your lawful possession prior to the disclosure and had not been obtained by you either directly or indirectly from us; or (c) is lawfully disclosed to you by a third party without restriction on disclosure; or (d) is independently developed by you. This agreement is governed by the substantive and procedural laws of California. You and Oracle agree to submit to the exclusive jurisdiction of, and venue in, the courts of San Francisco, San Mateo, or Santa Clara counties in California in any dispute arising out of or relating to this agreement.
    We are willing to license the programs to you only upon the condition that you accept all of the terms contained in this agreement. Read the terms carefully and select the "Accept" button at the bottom of the page to confirm your acceptance. If you are not willing to be bound by these terms, select the "Do Not Accept" button and the registration process will not continue.
    License Rights
    We grant you a nonexclusive, nontransferable limited license to use the programs only for the purpose of internal evaluation and testing of the programs and/or developing a single prototype of your application, and not for any other purpose. If you want to use the programs or the application you develop under this license for any internal data processing or internal business operations or for any commercial or production purposes, or you want to use the programs for any purpose other than as permitted under this agreement, you must obtain a production release version of the program by contacting us or an Oracle reseller to obtain the appropriate license. You acknowledge that we may not produce a production release version of the program and any development efforts undertaken by you are at your own risk. We may audit your use of the programs. Program documentation, if available, may accessed online at http://otn.oracle.com/docs.
    Ownership and Restrictions
    We retain all ownership and intellectual property rights in the programs. The programs may be installed on one computer only, and used by one person in the operating environment identified by us. You may make one copy of the programs for backup purposes.
    You may not:
    - use the programs for your own internal data processing or internal business operations or for any commercial or production purposes, or use the programs for any purpose except as permitted under this agreement;
    - continue to use the programs for a period longer than: (a) six months; or, (b) after the general availability of the programs, if any;
    - use the application you develop with the programs for any internal data processing or internal business operations or commercial or production purposes without obtaining a production release version of the programs by securing an appropriate license from us or an Oracle reseller;
    - remove or modify any program markings or any notice of our proprietary rights;
    - make the programs available or accessible in any manner to any third party;
    - use the programs to provide third party training;
    - assign this agreement or give or transfer the programs or an interest in them to another individual or entity;
    - cause or permit reverse engineering (unless required by law for interoperability), disassembly or decompilation of the programs;
    - disclose results of any program benchmark tests without our prior consent
    - disclose Confidential Information to any third party without our prior consent.
    Feedback
    Any Content that is provided to and Shared with Oracle relating to the programs shall be received and treated by Oracle on a non-confidential and unrestricted basis ("Feedback"), and Oracle shall have a worldwide, perpetual, royalty-free, irrevocable, nonexclusive, fully sublicensable license to use, reproduce, modify, adapt, translate, publish, publicly perform, publicly display, broadcast, transmit and distribute the Feedback for any purpose and in any form, medium, or technology now known or later developed. This includes, without limitation, the right to incorporate or implement the Feedback into any Oracle product or service, and to display, market, sublicense and distribute the Feedback as incorporated or embedded in any product or service distributed or offered by Oracle without compensation to you.
    Export
    You agree that U.S. export control laws and other applicable export and import laws govern your use of the programs, including technical data; additional information can be found on Oracle's Global Trade Compliance web site located at http://www.oracle.com/products/export/index.html?content/html. You agree that neither the programs nor any direct product thereof will be exported, directly, or indirectly, in violation of these laws, or will be used for any purpose prohibited by these laws including, without limitation, nuclear, chemical, or biological weapons proliferation.
    Disclaimer of Warranty and Exclusive Remedies
    THE PROGRAMS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. WE FURTHER DISCLAIM ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
    IN NO EVENT SHALL WE BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, DATA OR DATA USE, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT, EVEN IF WE HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. OUR ENTIRE LIABILITY FOR DAMAGES HEREUNDER SHALL IN NO EVENT EXCEED ONE THOUSAND DOLLARS (U.S. $1,000).
    Trial Programs Included With Orders
    We may include additional programs with an order which may be used for trial purposes only. You will have 30 days from the delivery date to evaluate these programs. Any use of these programs after the 30 day trial period requires you to obtain the applicable license. Programs licensed for trial purposes are provided "as is" and we do not provide technical support or any warranties for these programs.
    No Technical Support
    Our technical support organization will not provide technical support, phone support, or updates to you for the programs licensed under this agreement.
    End of Agreement
    This agreement, and your right to use the programs, will be terminated: (i) automatically upon the release of production-release versions of the programs, in which case you shall destroy all copies of the programs; (ii) by you, by destroying all copies of the programs; or, (iii) by us if you fail to comply with any of the terms of this agreement, in which case you shall destroy all copies of the programs.
    Relationship Between the Parties
    The relationship between you and us is that of licensee/licensor. Neither party will represent that it has any authority to assume or create any obligation, express or implied, on behalf of the other party, nor to represent the other party as agent, employee, franchisee, or in any other capacity. Nothing in this agreement shall be construed to limit either party's right to independently develop or distribute software that is functionally similar to the other party's products, so long as proprietary information of the other party is not included in such software.
    Open Source
    "Open Source" software - software available without charge for use, modification and distribution - is often licensed under terms that require the user to make the user's modifications to the Open Source software or any software that the user 'combines' with the Open Source software freely available in source code form. If you use Open Source software in conjunction with the programs, you must ensure that your use does not: (i) create, or purport to create, obligations of us with respect to the Oracle programs; or (ii) grant, or purport to grant, to any third party any rights to or immunities under our intellectual property or proprietary rights in the Oracle programs. For example, you may not develop a software program using an Oracle program and an Open Source program where such use results in a program file(s) that contains code from both the Oracle program and the Open Source program (including without limitation libraries) if the Open Source program is licensed under a license that requires any "modifications" be made freely available. You also may not combine the Oracle program with programs licensed under the GNU General Public License ("GPL") in any manner that could cause, or could be interpreted or asserted to cause, the Oracle program or any modifications thereto to become subject to the terms of the GPL.
    Third Party Technology
    The Programs may contain third party technology. We may provide certain notices to you in program documentation or otherwise in connection with such third party technology. If you are permitted to distribute a Program, you agree to include with the distribution all such notices and any associated source code for third party technology as specified, in the form and to the extent such source code is provided by us. For clarity, the existence of a notice does not affect the terms under which third party technology is licensed to you.
    Third party technology will be licensed to you either under the terms of this agreement, or, if specified in the program documentation, readme files or otherwise in writing, under separate license terms ("Separate Terms") and not under the terms of this agreement ("Separately Licensed Third Party Technology"). Your rights to use such Separately Licensed Third Party Technology under the Separate Terms are not restricted or modified in any way by this agreement.
    Entire Agreement
    You agree that this agreement is the complete agreement for the programs and licenses, and this agreement supersedes all prior or contemporaneous agreements or representations. If any term of this agreement is found to be invalid or unenforceable, the remaining provisions will remain effective.
    Last updated: 08/26/10
    Should you have any questions concerning this License Agreement, or if you desire to contact Oracle for any reason, please write:
    Oracle America, Inc.
    500 Oracle Parkway,
    Redwood City, CA 94065
    Oracle may contact you to ask if you had a satisfactory experience installing and using this OTN software download.
    >
    which is different from http://download.oracle.com/docs/cd/E17781_01/license.112/e18068/toc.htm#BABHFGHA regarding production or commercial purposes.

    At first sight, I was surprised too, but after reading both terms thoroughly I came to the same conclusion that orafad posted above: The text you posted is entitled Oracle Technology Network Early Adopter License Terms. Of course, EA-Terms are different from the ones for the production release. To illustrate the example with software from another company: It was possible to download betas of Microsoft Windows "for free", but it was just for evaluation, testing and "early adopting" purposes, not for productive use. Similar rules apply here. The final release will definetly not be published with that EA License. Oracle has published a draft of the final terms so you get an idea of what you'll be allowed to do with the software you evaluate when it will be released.
    -Udo

  • Query not using index when using 'or' clause

    I have a problem with something I can't understand about indexes in Oracle 11g.
    We can create test data with:
    create table test2(field1 varchar2(100),field2 varchar2(100),field3 number,field4 varchar2(100));
    create index test2_idx1 on test2(upper(field1));
    create index test2_idx1b on test2(field1);
    create index test2_idx2 on test2(field3);
    DECLARE
    j NUMBER :=1;
    BEGIN
    FOR i IN 1..500000
    LOOP
    INSERT
    INTO test2
    (field1,field2, field3, field4)
    VALUES
    ('field1='||i,'a', j, 'i' );
    IF (i mod 1000)=0 THEN
    j := j+1;
    END IF;
    END LOOP;
    COMMIT;
    END;
    EXEC DBMS_STATS.GATHER_TABLE_STATS ('system', 'test2');
    Then I make some explain plans which result I can't understand
    Query 1:
    SELECT * FROM test2 WHERE field3=1;
    Explain plan:
    Explain plan for query 01
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1003 | 28084 | 10 (0)| 00:00:01 |
    | 1 | TABLE ACCESS BY INDEX ROWID| TEST2 | 1003 | 28084 | 10 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | TEST2_IDX2 | 1003 | | 5 (0)| 00:00:01 |
    Everything OK here. Index is used.
    Query 2:
    SELECT * FROM test2 WHERE upper(field1)='FIELD1=1';
    Explain plan
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 28 | 4 (0)| 00:00:01 |
    | 1 | TABLE ACCESS BY INDEX ROWID| TEST2 | 1 | 28 | 4 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | TEST2_IDX1 | 1 | | 3 (0)| 00:00:01 |
    Everything OK again. Index is used.
    Query 3:
    SELECT /*+ USE_CONCAT */ * FROM test2 WHERE field1='FIELD1=1' OR field3=1;
    Explain plan
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1004 | 28112 | 14 (0)| 00:00:01 |
    | 1 | CONCATENATION | | | | | |
    | 2 | TABLE ACCESS BY INDEX ROWID| TEST2 | 1 | 28 | 4 (0)| 00:00:01 |
    |* 3 | INDEX RANGE SCAN | TEST2_IDX1B | 1 | | 3 (0)| 00:00:01 |
    |* 4 | TABLE ACCESS BY INDEX ROWID| TEST2 | 1003 | 28084 | 10 (0)| 00:00:01 |
    |* 5 | INDEX RANGE SCAN | TEST2_IDX2 | 1003 | | 5 (0)| 00:00:01 |
    Indenxes are used in concatenation. No problem again.
    Query 4:
    SELECT /*+ USE_CONCAT */ * FROM test2 WHERE upper(field1)='FIELD1=1' OR field3=1;
    Explain plan
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1004 | 28112 | 641 (4)| 00:00:08 |
    | 1 | CONCATENATION | | | | | |
    |* 2 | TABLE ACCESS FULL | TEST2 | 1 | 28 | 631 (4)| 00:00:08 |
    |* 3 | TABLE ACCESS BY INDEX ROWID| TEST2 | 1003 | 28084 | 10 (0)| 00:00:01 |
    |* 4 | INDEX RANGE SCAN | TEST2_IDX2 | 1003 | | 5 (0)| 00:00:01 |
    Here my problem arises. Why is test2_idx1 not being used? Is it because it is a function index? Is there any workaround in this cases?
    Thanks a lot in advance.

    Interesting. A "workaround" which I thought first was:
    SELECT /*+ USE_CONCAT */ * FROM test2 WHERE upper(field1)='FIELD1=1'
    UNION ALL
    SELECT /*+ USE_CONCAT */ * FROM test2 WHERE field3=1;
    | Id  | Operation                    | Name       | Rows  | Bytes | Cost (%CPU)| Time     |                                                                                                                                                                                                                 
    |   0 | SELECT STATEMENT             |            |  1001 | 28042 |    15  (74)| 00:00:01 |                                                                                                                                                                                                                 
    |   1 |  UNION-ALL                   |            |       |       |            |          |                                                                                                                                                                                                                 
    |   2 |   TABLE ACCESS BY INDEX ROWID| TEST2      |     1 |    42 |     4   (0)| 00:00:01 |                                                                                                                                                                                                                 
    |*  3 |    INDEX RANGE SCAN          | TEST2_IDX1 |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                                                                 
    |   4 |   TABLE ACCESS BY INDEX ROWID| TEST2      |  1000 | 28000 |    11   (0)| 00:00:01 |                                                                                                                                                                                                                 
    |*  5 |    INDEX RANGE SCAN          | TEST2_IDX2 |  1000 |       |     5   (0)| 00:00:01 |                                                                                                                                                                                                                 
    -------------------------------------------------------------------------------------------   But I do not like using UNION for such tricks. So I thought, what would ORACLE do without hint?
    SELECT  * FROM test2 WHERE upper(field1)='FIELD1=1' or field3=1;
    | Id  | Operation                        | Name       | Rows  | Bytes | Cost (%CPU)| Time     |                                                                                                                                                                                                             
    |   0 | SELECT STATEMENT                 |            |  1001 | 42042 |   176   (0)| 00:00:03 |                                                                                                                                                                                                             
    |   1 |  TABLE ACCESS BY INDEX ROWID     | TEST2      |  1001 | 42042 |   176   (0)| 00:00:03 |                                                                                                                                                                                                             
    |   2 |   BITMAP CONVERSION TO ROWIDS    |            |       |       |            |          |                                                                                                                                                                                                             
    |   3 |    BITMAP OR                     |            |       |       |            |          |                                                                                                                                                                                                             
    |   4 |     BITMAP CONVERSION FROM ROWIDS|            |       |       |            |          |                                                                                                                                                                                                             
    |*  5 |      INDEX RANGE SCAN            | TEST2_IDX2 |       |       |     5   (0)| 00:00:01 |                                                                                                                                                                                                             
    |   6 |     BITMAP CONVERSION FROM ROWIDS|            |       |       |            |          |                                                                                                                                                                                                             
    |*  7 |      INDEX RANGE SCAN            | TEST2_IDX1 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                                                             
    ----------------------------------------------------------------------------------------------- Thist looks perfect to me. (Please ignore the "higher" cost on the second plan. On your real data, it should be faster. Is it?)

  • Index not used on view when table stats exist

    Hello,
    I would be grateful if someone comes with ideas on the following problem I'm currently facing.
    I have a table with XMLTYPE data type column:
    sql-->desc ACFBNK_STMT008
    RECID     NOT NULL     VARCHAR2(200)
    XMLRECORD XMLTYPE
    I have a view V_ACFBNK_STMT008 on that table, in which the view columns are defined as extracted tags values from the XMLTYPE field, e.g. for the view field N_BOOKING_DATE:
    numcast(extractValue(xmlrecord,'/row/c25')) "N_BOOKING_DATE"
    (note: numcast is just a simple function that returns TO_NUMBER of its input argument)
    I have also a function-based index on this field of the table:
    CREATE INDEX train4.NIX_ACFBNK_STMT008_C25
    ON train4.ACFBNK_STMT008("TRAIN4"."NUMCAST"(extractValue(xmlrecord,'/row/c25')))
    And so, I'm executing on the view the following SQL statement:
    SELECT RECID FROM V_ACFBNK_STMT008 WHERE (N_BOOKING_DATE > TO_NUMBER('20070725'));
    Now, the problem comes: when statistics exist on the view base table (that is ACFBNK_STMT008) then the above statement is not using the index and is making a "table access full". When I delete the statistics for the table then the SQL runs fast with an "index range scan".
    Which is further strange - when I change the ">" operand with a "=" the SQL statement correctly captures the index regardless of whether or not statistics exist.
    I've tried to manually rewrite the SQL and include the "numcast" function in it:
    SELECT RECID FROM TRAIN4.V_ACFBNK_STMT008 WHERE ( N_BOOKING_DATE>train4.numcast(TO_NUMBER( '20010725' ) ));
    And in this way the index is used OK even with statistics existing!
    But regretfully I don't have a way to change the application and the SQL, so the only things I can change is the view and/or the index.
    Thank you in advance,
    Evgeni
    P.S.
    I've tried gathering statistics in both the following ways but still the problem persists:
    sql-->analyze table train4.ACFBNK_STMT008 compute statistics;
    sql-->exec dbms_stats.gather_table_stats(ownname=>'TRAIN4', tabname=>'ACFBNK_STMT008', CASCADE=>TRUE, partname=>NULL);

    Oh, and I forgot to mention: I cannot change the view definition as well (for example, to remove the "numcast"), since every now and then the application would recreate it automatically with the same code. :(

  • Indexes not used in Oracle 8i

    Hi Everybody,
    Does anybody know how can i know which indexes are not used in our Oracle 8iR3 Database.
    We need to purge as soon as possible all indexes not used
    in our Datawarehousing system because they're growing and growing.
    I know there's some mechanism in Oracle 9i to query which are unused is it possible to simulate something similar?
    Kind regards and thank you in advance.
    José Luis Pérez
    [email protected]

    Are you asking about index monitoring in 8i? One way (and there aren't very many at all) of doing this is to collect (query them out of the DD) execution plans and scan those for index usage.

  • Which index  I should create  Btree or Bitmap  index?

    I have table with columns c1,c2,c3
    I want to create index on column c1
    which index I should create Btree or Bitmap index
    the column contain 50% unique values and 50% duplicate values
    If Btree why?
    If Bitmap Why?
    I know that
    Btree is used when there more unique values (high cardinality)
    Bitmap is used when there less unique values (low cardinality)

    read this -
    Deadlocks with Bitmap Indexes
    Bitmap indexes were designed to be used solely within data warehouses, i.e. where the vast majority of the database activity is reading data,
    and there's very little (or no) data modification, except for batch processes which occasionally re-populate the warehouse.
    Each "row" in the bitmap index contains references to potentially many different rowids, in contrast to a B*-tree index which references a single rowid.
    It should be obvious, therefore, that, since the transactional mechanism is the same for all database operations, that any DML on a table which impacts the bitmap index may end up locking (or attempting to lock) many different "rows" within the index.
    This is the key concept with deadlocks in bitmap indexes, you're not being deadlocked on the underlying table, but on the index blocks. Courtesy - http://www.oratechinfo.co.uk/deadlocks.html
    hope u got it now...

Maybe you are looking for

  • Can I print to more than one printer from one Mac - at the same time?

    Hi, I'd like to set up a few printers in order to handle large jobs occasionally. But the print jobs are going to be coming from InDesign which I have on only one of the Macs. Can I do either of these...? a) connect more than one printer to a USB hub

  • Preparedstatement and setdate

    Hi, I am using prepared statement to enter date into the table. Setdate has been giving me problems. When I say: pstmtAdd.setDate(i + 1, etaDate, c); it gives me a compiler error. Here etaDate is a date field and c is a calendar. The compilor error s

  • Peoplesoft HCM 9.1/Oracle 11g installation on Windows 7

    Hello All, I am trying to install Peoplesoft HCM 9.1 / Oracle 11g on windows 7 64-bit platform ( laptop). So far, I installed the loopback adapter and then installed Oracle 11g database enterprose version successfully. I can login to the database via

  • Average Cost of inventory [Query Required]

    Hi All, *[an advance thank for an urgent help]* I had find average cost 5.59 based on following information using excel. i have Qty, unit cost and linecost and tran_type column in databased.Based on below calculation how i get this info through SQL.

  • Hi, what formula would I need to use to show current age?

    I'm not a big numbers user and have very little concept of how to use it. What I need is a formula to calculate an age in years and months based on a date of birth in a previous column. Many thanks in advance for your help. Kate