Normal index in oracle.

i have a city_tbl with columns ( city_cd, city_name,state_cd) in oracle 11g release2
city_cd is a primary key.
i ran the query
select city_name from city_tbl where state_cd = 'AL'
expalin plan shows full table scan
now i create normal index on state_cd column
after running the query still explain plan shows full table scan.
after creating the index why there is full table scan ?

Hi,
it looks like the optimizer is doing the right thing by ignoring your index and doing the full table scan. Full table scan is a perfectly valid way of retrieving data and in many cases is more efficient than an index access, because a) it uses multiblock reads b) doesn't have to go through index blocks first before reading the data.
In your case, the optimizer estimates that the cost of reading the table via a FTS is equivalent to 34 single-block reads. Index access in your case is more expensive, because while it's pretty cheap to acquire rowids of desired rows (only 2 reads are needed), the desired table rows are scattered around 115 blocks, so Oracle would have to make 117 reads to retrieve the data via an index.
Of course, this is only true if the optimizer is right in its assumptions about table size, index structure, predicate selectivity and clustering factor. If it's not, then you need to find where exactly the optimizer is wrong and correct it (e.g. by collecting a histogram on the column in WHERE clause).
Best regards,
Nikolay

Similar Messages

  • Differences between function based index and normal index

    Hi,
    Please Give me some differences between function based index and normal indexes.
    1. Is there any performance gain in function based index?
    2. Why indexes created in DESC are treated as function based?
    3. Every DESC index is b-tree index?
    Thanks

    check this link. This would give u a basic idea of what a function based index is .
    http://www.oracle-base.com/articles/8i/FunctionBasedIndexes.php
    --Prasad                                                                                                                                                                                                                                                                                                                                       

  • How to find unused indexes in oracle 10g r2

    Hi all,
    db:oracle 10.2.0.3
    os:solaris
    i want rebuilt the some of the indexes (due poor performence of db)
    how to find the unused indexes in oracle 10gr2 database.?
    can any one help me out plz.

    kk001 wrote:
    Hi all,
    db:oracle 10.2.0.3
    os:solaris
    i want rebuilt the some of the indexes (due poor performence of db)
    how to find the unused indexes in oracle 10gr2 database.?
    can any one help me out plz.You can use V$OBJECT_USAGE.
    But how you decide need rebuilding indexes?
    How you decide problem related indexes?
    What is exactly your mean "due poor performence of db"? some queries hang/long running or whole system hang or has poor performance?
    In generally do not need rebuilding index(unless specially cases),first give we above questions`s answers.

  • How to enforce index in oracle query

    Hi all
    how to enforce index in oracle query
    Regards

    Use INDEX hint to force Optimizer to use the specfied index.
    You really need to investigate why Optimizer doesn't choose the index. Remember, INDEX SCAN are not always GOOD.
    Jaffar

  • Normal Indexes created for Primary/Unique Keys in Oracle8/8i

    I remeber prior to Oracle8, when we create a Primary/Unique Key constraints, an unique index will be created by default. But I am noticing now in 8/8i when we create either Primary or Unique key, only normal/simple index is created. We are not able to override this normal index either by dropping and recreating the index alone. I believe it would be pretty much better in case of performance if we have a unique index for this columns. Can anybody help why is it changed so in 8/8i??
    Thanks,
    R. M.

    Dear Rob,
    since your answer was helpful and since it was the only one I will grant you full points on that.
    Thanks again for your input. In case other developers should look this thread up being confronted
    with the same kind of problem, here is how we solved it:
    We added an artificial primary key (a number of type NUMC 8) to the table which is supposed to
    include the structure. This key alone takes care of the uniqueness of eacht entry.
    All the others fields that we want to have available for a fast direct access, including the ones
    from the included structure, are put together in a secondary index.
    best regards
    Andreas

  • How to implement "Filtered Indexes" in Oracle?

    I know that function-based index can (kind-of) create index for only a portion of all the rows in a table,
    create index idx_abc_01 on t_abc (case when end_dt > '01-APR-2008' then end_dt else null end);
    /* to use the index, you have to use the same express in the filter clause */
    select * from t_abc where xyz in ('O', 'S', 'X') and
         case when end_dt > '01-APR-2008' then end_dt else null end
              between '12-JUL-2008' and '15-JUL-2008';But this approach is very inflexible because the expression in the where clause has to exactly match the index creation, otherwise that filtered index will not be used.
    MS SQL Server 2008 has a new feature called - Filtered Indexes
    CREATE NONCLUSTERED INDEX fidx_abc_01
        ON t_abc ( EndDate )
    WHERE EndDate > '20040401';
    select * from t_abc where EndDate between '20050121' and '20050130';[url http://msdn.microsoft.com/en-us/library/cc280372.aspx]Filtered Indexes can be very helpful in both OLTP and DW. I'm wondering how to get the same thing done in Oracle.
    Any suggestion beyond [url http://erturkdiriksoy.wordpress.com/2008/06/30/filtered-indexes-on-oracle/]Dunyada?

    In 11.2, if you're building a data warehouse (and assuming that implies you have the partitioning option), you can declare that certain partitions of a local index are unusable which prevents Oracle from building them. If T_ABC were partitioned on END_DT, that would allow arbitrary queries where Oracle could perform partition pruning to make use of the index if it was available for those partitions without the need for an exact expression match.
    Beyond that, if you are creating a function-based index, you would often want to create (or modify) the view that your application queries to specify the condition (i.e. a VW_RECENT_ABC that only has post-April, 2008 data) so that queries didn't have to specify the condition exactly.
    Justin

  • How to disable the index in oracle

    Hi,
    Is there any way we can disbal the index in oracle.
    For the performance issue,I want to disable some of the indexes which i have created earlier. I dont want to drop the index.
    I tried the below command
    Alter Index <Schema>.<Index_name> Disable;
    I am getting the below error message:
    ORA-02243: invalid ALTER INDEX or ALTER MATERIALIZED VIEW option
    Thanks,
    Krishna
    .

    Hello,
    I have a question related to disabing index and thought I would post it in thread.
    I'm altering a column length to increase the size and getting "ORA-30556: functional index is defined on the column to be modified".
    On searching more about this error, it seems like the function index must be dropped before altering the column.
    The table I'm dealing with is huge.
    Question 1:
    In case of dropping and recreating the index, should the following steps be done:
    - Drop Index
    - Alter the column to increase the size
    - Recreate the index with NOLOGGING and NOPARALLEL clause
    - ALTER INDEX to turn on LOGGING
    - Gather Statistics on that index
    Question 2:
    Is there anything else that should be done when the index is dropped and re-created?
    Question 3:
    What are the side-effects of carrying out the above steps in a huge table with around 15 million rows?
    Question 4:
    Would it work if I disable the index, alter the column and reenable the index?
    Do I have to rebuild the index and gather Stats upon reenabling it?
    Thanks!

  • Oracle Text index hangs(Oracle 11g linux enterprise edition)

    Hi guru,
    One very criticial and showstopper issue coming in Oracle Text Indexing.
    I have table ResourceTable(ResId,Contents blob ,docformat)
    I am creating text index on Contents column by using follwing command:
    create index [IndexName] on [TableName] (contents) indextype is ctxsys.context ('lexer mylex stoplist ctxsys.default_stoplist format column ISDOCFORMAT sync(every "sysdate+1/24") storage my_text_storage memory 200M')parallel 2
    I found there is one document of text/html type which hangs oracle text indexing thread.Oracle doest not give any error message keep using CPU 100% and no progress.
    I then create test table with same stucture and put this corrupted documet record in this table.and did indexing again but its not doing index /not ignoring it and hangs .We have also tried to use timeout feature of inso filter so that if such type of document comes at the time of indexing oracle text indexing process will bypass it after specific time interval but still same issue comes and oracle is not bypassing such faulty document.
    This is realy show stopper issue and any kind of help will be greatly appricited.

    You need to raise an SR with Oracle Support for this, and send them the file which is causing the hang. It should then be easy to investigate the problem and schedule a fix.
    If you don't have a support contract, you could send the file to me and I'll raise a bug. However, if we fix it you won't be able to get the fix until it appears in the next downloadable version.
    - Roger
    roger.ford @ oracle.com

  • Database locking (state versus stateless) and indexes on oracle database

    Does anyone have a link to a document talking about database locking (state versus stateless) and talking about indexes in oracle database?

    No version information and no information as to what you mean by "locking" so no help is possible.
    You could mean LOCK TABLE in version 7.3.4 or SELECT FOR UPDATE in 11.1.0.7 or something else entirely.

  • Huge Databases to be indexed with Oracle Text?

    Is there anybody with experience with Oracle Databases with several TB and an fulltext index with Oracle Text? Are there any success stories by oracle?

    Oracle Text, data load by partitation, async refresh index.
    Hi Gurus,
    Here I got a question,
    Serniro:
    A table with 2 partitions, text index created.
    When I load data into 1st partition, performance good.
    Sync partion text index, performance good.
    Then I load data into 2nd partition, it's so slow.
    My question is,
    How to disable/offline 2nd partition text index?
    Sync it after I loaded 2nd partition data.

  • Migration Index from Oracle.

    Hi,
    I want to convert the below mentioned index from oracle  to SQL Server.
    create index IDX_XXX on ASSETTABLE (TRUNC(TIME_STAMP), ASSET_ID)
    I try to use CAST function instead of
    Trunc, but it shows Error. Please Provide a solution for me.
    Balakrishnan APD

    Perhaps you should hire a consultant.  Your questions assumes that the people who frequent this forum know Oracle functionality and PL-SQL - which isn't very likely.  You might be more likely to receive useful responses if you can at least identify
    what TRUNC does and what datatypes are involved.  I will also suggest that you reconsider some basic assumptions that you may have made - specifically that you can translate on a 1-for-1 basis every feature / code snippet in Oracle to a similar feature
    in SQL Server.  It may be that you need to modify your schema to achieve a similar implementation (or perhaps maybe you don't need a particular feature/implementation at all).  I also suggest that you avoid using reserved words (or ones very
    similar to reserved words) as identifiers - specifically "TIME_STAMP").  If you haven't yet, you should read the documentation regarding the timestamp datatype just to make sure that you understand what that datatype is - there might be a surprise waiting
    for you.

  • Query not considering function based index in oracle 11g

    I have a query which used Function Based Index when run in oracle 9i but when I run the same query
    without any changes, it does not consider index. Below is the query:
    SELECT distinct patient_role.domain_key, patient_role.patient_role_key,
    patient_role.emergency_contact_name,
    patient_role.emergency_contact_phone, patient_role.emergency_contact_note,
    patient_role.emergency_contact_relation_id,
    patient_role.financial_class_desc_id, no_known_allergies, patient_role.CREATED_BY,
    patient_role.CREATED_TIMESTAMP,
    patient_role.CREATED_TIMESTAMP_TZ, patient_role.UPDATED_BY, patient_role.UPDATED_TIMESTAMP,
    patient_role.UPDATED_TIMESTAMP_TZ,
    patient_role.discontinued_date
    FROM encounter, patient_role
    WHERE patient_role.patient_role_key = encounter.patient_role_key
    AND UPPER(TRIM(leading :SYS_B_0 from encounter.account_number)) = UPPER(TRIM(leading :SYS_B_1 from
    :SYS_B_2))
    AND patient_role.discontinued_date IS null
    AND encounter.discontinued_date IS null ;
    Index definition:
    CREATE INDEX "user1"."IX_TRIM_ACCOUNT_NUMBER" ON "user1."ENCOUNTER" (UPPER(TRIM(LEADING
    '0' FROM "ACCOUNT_NUMBER")), "PATIENT_ROLE_KEY", "DOMAIN_KEY", "DISCONTINUED_DATE")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT)
    TABLESPACE "user1"
    Database : Oracle 11g (11.2.0.3)
    O/S : Linux 64 bit (the query does not consider index even on windows os)
    Any suggestions?
    -Onkar
    Edited by: onkar.nath on Jul 2, 2012 3:32 PM

    Onkar,
    I don't appreciate you posting this question in several forums at the same time.
    If I would know you also posted this on Asktom, I wouldn't even have bothered.
    As to your 'issue':
    First of all: somehow cursor_sharing MUST have been set to FORCE. Oracle is a predictable system, not a fruitmachine.
    Your statement the '0' is replaced by a bind variable anyway is simply false. If you really believe it is not false, SUBMIT a SR.
    But your real issue is not Oracle: it is your 'application', which is a mess anyway. Allowing for alphanumeric numbers is a really bad idea.
    Right now you are already putting workaround on workaround on workaround on workaround.
    Issue is the application: it is terminal., and you either need to kill it, or to replace it.
    Sybrand Bakker
    Senior Oracle DBA

  • MS Office 2007 files are not being indexed (Failed to Index)  in oracle

    Oracle is not able to index MS Office 2007 files who are having extensions like *.docx, *.pptx, *.xlsx. I googled and found that its a bug in oracle. Have they released the fixes for it.
    Request to please help me in this regard

    user10933671 wrote:
    There is no particular error it shows. The files are not getting indexed. In our application it says currently *.docx files are not index. My Oracle client is of version 10.2.0.
    Since am really new to this, can you please tell me where i can find Metalink note 732823 as am not a paid customer.
    That would be a problem. Access to patches (and MetaLink) are part of what you pay for when you buy a support contract.
    Plz help me in this regard
    Thanks in advance
    Edited by: user10933671 on Apr 15, 2009 5:53 AM

  • How to create clustered index in Oracle ?

    I need to Create unique clustered index idx_col1 on table1(col1) in Oracle 9i.
    Should I declare it at creation of table as index-organized ? My table is created with the code like Create table table1 as select ..... from ....
    Can anybody post an example ?
    Thanks

    Oracle does not have the concept of a clustered index from SQL Server. You may get something similar if you create your table as an index organized table, i.e.
    CREATE TABLE my_iot (
      col1 number primary key,
      col2 number
    organization index;or you may get similar benefits by creating a cluster. It really depends on what functionality you're trying to replicate and what problem your trying to solve. Either way, though, you'll have to have separate steps to create the table and then to insert the data.
    Justin

  • Structure of Indexes in oracle Text

    Hi,
    I like to know which Indextyp ist using Oracle Text.
    Is it B-Tree Indexes? Or which structure does oracle use to index the dokuments?
    I know there are some differences between ctxcat and context.
    Can anyone help?
    regars,
    Arsineh

    context is an inverted index structure. ctxcat is based on a b-tree.

Maybe you are looking for

  • Ipod classic won't sync with iTunes 10.4

    My ipod classic 160 does not want to sync with the latest iTunes update(s).  The same thing happened with the last update about a month ago.  How do I fix this?  The last time I put the ipod in disc mode and that seemed to work.  But it isn't working

  • How to make "files" window move to background.

    My files window can only be opened and closed, there appears no way to have it move to the background if it is not the active screen. This was not the case in previous versions. Am I missing something or somewhere to change some setting? Thanks

  • Data Grid display in flex

    Hello All - I am new to flex and just had a quick question. My XML file structure is like this I would like to create a table like this. Id and resourceId are lined but I have to display in single table fullname      location  Type ======     ====== 

  • Photoshop CS3 and CS5 Co-existing.

    I have been very luck to be given Photoshop CS5 for Fathers day and am currently running CS3 Extended on my Win 7 64bit Professional PC system. My question is can I install CS5 64bit onto my PC, (with Bridge and Raw), while still keeping CS3 32bit, (

  • N7K-F312FQ-25, Not FEX fabric capable?

    Dear all, Anyone struggled with the same problem: According the specs the F3 line card should support FEX 2000 (in our case: NX2248PQ and NX2238TP) While configuring an interface with "SWITCH MODE FEX-FABRIC", the system complains with: DC1(config-if