Restrict the use of index while quering

Hi All
I have a simple emp table with columns empid, name, sal. Empid has a primary key imposed.
Now when i write a statement like this,
select * from emp where empid = <value>;
the optimizer will make use of index.
The question is........... is there anyway to make oracle bypass the use of index without change in above query.

Why do you worry of performance issues when the table size is small , when it is huge and the column you r trying use in the query is also indexed the oracle finds the Best execution method to do the execution whether index exists or not , Oracle has a very intelligent Optimizer and no need to use hints unless and until it is really mandatory or when u r using a very complex query where Oracle is not able to deduce the best Execution plan . But by all means you should look at the execution plan how a cerain query Oracle knows of doing it or when u have a diferering opinion then only at that point you force a Optomizer Hint . For other normal cases like the one you are asking it is best to get the results how Oracle executes it and no forcing is required .

Similar Messages

  • Use of substr function will avoid the use of indexes in a table

    i have one table which will contain some 3,00,000 records, it contains some 11 primary keys i am using some update statements to update some fields in the records (of 3,00,000 i will compare some 1,50,000 records with 1,50,000 another records) i am using substr function in all the select statements. whether usage of substr function will avoid the use of index
    can any one clarify?

    contains some 11 primary keys by this I suppose you mean to say the table has a composite PK on 11 columns.
    i am using substr function in all the select statementsCould you please post your SQL statement?

  • What is the use of Indexes in ODS&Infocube??

    What is the use of Indexes in ODS&Infocube??

    An Index can improve the reading performance when data is searched for values of fileds contained in the index.
    The fact whether the Index is used or not depends on the database optimizer, which decides it after taking the following under consideration:
    - Size of the table
    - Fields in the index compared to the fields in the statement
    - The quality of the index (its clustering factor)
    One backdraw of Index is that they decrease writing performance, as they are maintained during the write to the table.
    Hope it helps you,
    Gilad

  • Restricting the Search  for Material while creating Shopping Cart

    HI SRM GURUS
    We are in SRM version 5.0 and following a classic scenarios.
    In search strategy while we are creating a shopping cart and we click on the start button a list of all the  materails  appear from where the user can select any item.
    Now in R/3 if a user belongs to Mumbai plant can we restrict the search that only material existing in Mumbai plant in R/3 appears in the search criteria and not that all the materials are displayed.
    Regards,
    Nimish Sheth

    Hi Vadim,
       The Plant related data for products/material is not stored anywhere in SRM.Then where can I apply the filters for the materials pertaining to the specific  plants through the BADI BBP_F4_READ_ON_ENTRY through the Method GET_PRODUCT?
    Regards,
    Disha.

  • How to get restriction contents using eclipse xsd while reading schema's

    Hello,
    I am using XSD package from eclipse to read my schema structure (which is very complex) The code part where i am problem is as:
    If the schema is having element like :
    <xs:element name="Alignment" default="Center">
    <xs:annotation>
    <xs:documentation>
         Alignment can be any of the following three.     Left Right Center
    </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
    <xs:restriction base="xs:string">
         <xs:enumeration value="Left"/>
         <xs:enumeration value="Center"/>
         <xs:enumeration value="Right"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    Then i am able to read all part. By the way the problem is how to read the restriction part (that is the base ) from the simple part. Any body is having any clue ?
    Regards,

    Pleast take a look at "Definer's rights and invoker's rights" in the following article:
    http://docs.oracle.com/cd/E11882_01/timesten.112/e21639/accesscntl.htm#BABDDCHC
    I guess you need to define a stored procedure with "invoker's rights".
    If this is what you are looking for will have to define it in the stored procedure that you are going to call.
    The syntax is as follows:
    create or replace procedure <yourprocedure> authid current_user ...
    ...or (the following is the default, you don't have to use the "authid definer" keywords):
    create or replace procedure <yourprocedure> authid definer ...
    ...hm

  • Why is the security policy restricting the use of the camera on my phone?

    I started off being able to use my camera. I encrypted the phone but then I decrypted the phone. Now I cannot use the camera on my Samsung Galaxy s5. Please help.

        Oh no GreatApe! I am sorry that you have been having issues with your camera! We want you to be able to snap away and take all the pictures you want! Are you getting an error? Let us know so that we can investigate further!
    ErinW_VZW
    Follow us on Twitter @VZWSupport

  • How to restrict the the oreder reason list while creating sales order

    Hi gurus,
    Can anyone suggest me
    how to restrict the Order rerson list
    while creating the sales order in VA01
    Thanks & Regards
    kalyan.

    hi,
    Try this exit:
    Enhancement            MMFAB001     User exit for generation of release order                    
    Thanks,
    AMS

  • Restrict the LONG RAW Column with less than 32760 bytes in the SELECT

    When i am trying to access a LONG RAW Dataype wchich has characters greter than 32760 bytes i am getting this error.
    Error -6502: ORA-06502: PL/SQL: numeric or value error
    I came to know that PL/SQL will only be able to access the first 32760 bytes of a LONG RAW. If we try to fetch a LONG RAW from the database into PL/SQL variable which exceeds the 32760 byte limit then we encountered the above error.
    Can anyone tell to avoid this error can we write a query to restrict the output to get only those records which has LONG RAW length less than 32760 bytes.
    Since we canot use utl_raw.length() in the Select Statement, is there any function to restrict the the records for less than 32760 Bytes only for LONG RAW datatype, so that i will not get any records for more than 32760 bytes and we will not get this error.
    REquest you to please help.

    Hi
    we do not have an option of migrating the LONG RAW to BLOB or any kind of ALTER to the table.
    We want to restrict the use of Records from the Table which has data for LONG RAW column less than 32760 bytes, so that we will not get the PL/SQL numberic Error
    any function for LONG RAW that can be used in SQL like for varchar2 we can use
    select length(NAME) < 100 from tb_emp+
    i.e it will get records only which has NAME less than 100 characters.

  • Want to restrict the vendor at plant level

    Hi Experts,
    As per standard SAP, once the vendor is extended to comapny code then buyer can place order in any plant of same company code. My client wants to restrict the use of vendor at plant and after some business approval, will allow to use the vendor for specifc that plant. Could you please help me, how can I acheive this ?
    Thanks in advance,
    Regards,
    Ajit

    There is no solution for you in standard you have to develop something yourself.
    It is even possible to create purchase orders before a company code view is created for a vendor master, hence it cannot be controlled via company code blocks. The block at company code will have an effect on goods receipt and invoice receipt, which is too late.
    Purchasing blocks can only be set at purchasing organisation level. Even you can create a vendor with a plant level , it is not possible to set a block at this level. If this purchasing organisation serves many plants then a block will affect all plants.
    only with a  purchasing organization specific responsible for a single  plant you can meet your requirement in standard with a procurement block at purchasing org level.

  • How to restric the use of Business Area and Plant in PTC module

    Hi Expert,
    I am facing a problem with restricting the use of Business Area and Plant in PTC module.
    In this project we are trying to controle the user access or transaction as per the Business Area and Plant.
    We have applied same authorisation in the PTF module.
    Please help me if there is any authorisation object which give Plant and business area restrictions for all the transactions.
    Note: We have already inserted two authorisations object manually -
    1) F_BKPF_GSB
    2) A_IMPR_GSB
    but it's not working, is there any other way to restrict all the trasactions as per the Business Area and Plant.
    Regards,
    Venkatesh

    Hi,
    have you done OMJ7?
    Anyway you can assign plant to Branch and restrict by Validation rules (GGB4)
    Regards

  • Wat is the use of occurs

    hi all
    wat is the use of occurs while declaring internal table.
    thankn in advance

    Hi
    The OCCURs Clause is used for declaring the SIZE of the Internal Table..
    For EG:
    Data: begin of itab occurs 0, means this will create an internal table with 8KB of memory.
    But if you are specifrying
    data:begin of itab occurs 10, this will create an internal table with 10 rows(according to the structure of the internal table)...
    Reward All Helpfull Answers........

  • Apple restrict flash using products

    Hello,
    I am upset right now because i was hoping that Adobe would release a flash player for the iPhone and iPod touch... They actually did but apple is restricting the use of flash so Adobe cant offer it! Anyone knows why??

    Axisky--
    I share the same feelings with what you are saying of apple blocking flash out of the iPod touch/Iphone. Mike Chambers, Adobe’s Principal Product Manager for developer in a blog post on Tuesday that the company will be ceasing its efforts to bring Flash-based applications to the iPhone. Adobe Creative Suite 5 included an easy way for Flash developers to convert their existing Web-based games and other Flash applications to iPhone apps. That feature was Adobe’s way of sidestepping Apple’s choice not to allow Flash on its mobile platform. Apple doesn't sound terribly broken up about Adobe's announcement that it would stop developing its Flash-to-iPhone, but I'm certainly disappointed.
    Apple keeps talking about open sources vs flash being close platform. That is very silly of apple saying that, because let's talk about how apple deals with the app store policies for blocking good apps from their ecosystem. If a developer comes with a good application for apple devices that competes with apple installed application, apple just simply deny the app to show up on the app store. For the simple reason that you are trying to take competition from apple by offering a application with similar features that apple offers. I applaud google for taking the better approach and joining adobe to bring flash to their devices. When I upgrade my phone this year, I'm buying an android phone instead of an Iphone(which apple doesn't offer flash).

  • How to restrict the Number of sales orders in theTCode:VL10A whil creation

    I'm creating the Delivery by using the batch job with program: RVV50R10C Here I need to restrict the number of sales orders numbers while creating deliveries for sales orders
    Like system should pick the sales orders (sales documents) from 1 to 100 OR 100 to 200
    Please advise me how to do it and what changes I need to do it

    Hi,
    Aslo, you can see Note 198137 - VL10: Customer-specific enhancements / user exits. As is for SO, check subroutine LV50R_VIEWG03. If cf_subrc = 1 thin this SO isn't seen in list.
    ***INCLUDE LV50R_VIEWG03 .
    *&      Form  POSTAB_VEPVG_FILL_USER
    FORM POSTAB_VEPVG_FILL_USER
         USING    IX_LIST_PROFIL    TYPE      SHP_VL10_LIST_PROFIL
                  IX_PARAMETERS     TYPE      SHP_VL10_PARAMETERS
                  IX_SELECT_OPTIONS TYPE      SHP_VL10_SELECT_OPTIONS
                  IT_ENQUEUE        TYPE      SHP_VL10_PACKAGE_T
                  IX_SD_ORDER       TYPE      SHP_VL10_SD_ORDER
                  IS_VEPVG          TYPE      VEPVG
         CHANGING CS_POSTAB         TYPE      SHP_VL10_ITEM
                  CF_SUBRC          TYPE      SYSUBRC.
    CF_SUBRC = 0.
    *  cs_postab-zzfield = ......              "add new field to List
    *  if xxxxxxx = yyyyyyy.
    *    cf_subrc = 1.                         "Exclude this index from List
    *  endif.
    ENDFORM.                    " POSTAB_VEPVG_FILL_USER
    I hope this helps you
    Regards
    Eduardo

  • The plan doesn't use the index but the cost of INDEX FULL SCAN looks better

    Hi,
    Well, I'm sure I miss the boat... and if the question is pretty tricky, the answer is probably :"You're stupid Greg!". Well anyway, you'll probably be interested in trying to answer it as I've spent some times on it without any result ! I use Oracle XE on Windows...
    1) Below is my query and its plan. You'll find the full schema generation script at the end of this email. Look at the cost (468) of the plan and the cost of the same query when you force the use of the index (116). Why is this ?
    select count(distinct col5)
      2    from demo
      3      where col1 between 1 and 50000
      4        and col2=col1
      5        and col3=col1
      6        and col4=col1;
    Plan d'execution
    Plan hash value: 2072716547
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     1 |   116 |   468   (2)| 00:00:06 |
    |   1 |  SORT GROUP BY     |      |     1 |   116 |            |          |
    |*  2 |   TABLE ACCESS FULL| DEMO |     1 |   116 |   468   (2)| 00:00:06 |
    Predicate Information (identified by operation id):
       2 - filter("COL2"="COL1" AND "COL3"="COL1" AND "COL4"="COL1" AND
                  "COL1"<=50000 AND "COL2"<=50000 AND "COL3"<=50000 AND "COL4"<=50000 AND
                  "COL1">=1 AND "COL2">=1 AND "COL3">=1 AND "COL4">=1)2) When I force the use of an index (with a Hint), You'll see the cost of the plan is 116 which is definitly better than the TABLE ACCESS FULL (468) :
    SQL> l
      1  select /*+ index(demo demo_idx)*/ count(distinct col5)
      2    from demo
      3      where col1 between 1 and 50000
      4        and col2=col1
      5        and col3=col1
      6*       and col4=col1
    SQL> /
    Plan d'execution
    Plan hash value: 189561699
    | Id  | Operation                    | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |          |     1 |   116 |   437   (2)| 00:00:06 |
    |   1 |  SORT GROUP BY               |          |     1 |   116 |            |          |
    |   2 |   TABLE ACCESS BY INDEX ROWID| DEMO     |     1 |   116 |   437   (2)| 00:00:06 |
    |*  3 |    INDEX FULL SCAN           | DEMO_IDX |     1 |       |   436   (2)| 00:00:06 |
    Predicate Information (identified by operation id):
       3 - filter("COL2"="COL1" AND "COL3"="COL1" AND "COL4"="COL1" AND
                  "COL1"<=50000 AND "COL2"<=50000 AND "COL3"<=50000 AND "COL4"<=50000 AND
                  "COL1">=1 AND "COL2">=1 AND "COL3">=1 AND "COL4">=1)3) My question is why is plan1 used while plan2 should be considered better by the optimizer regarding the cost (to make the case even more complex, plan1 is actually more efficient but this is out of the scope of my question. I know that and I know why !).
    You'll find a script to generate the structures and data below. I can send you the 10053 traces if you what to go furthermore. Take care the index is a REVERSE index (Don't know if query rewrite should be enabled in order to take advantage of this type of index but it is set to "true" (and "trusted") :
    drop table demo;
    create table demo (col1 number not null,
        col2 number,
        col3 number,
        col4 number,
        col5 varchar2(500));
    begin
      for i in 1..100000 loop
        insert into demo values (i,i,i,i,'This column is used to raise the High Water Mark and '||
                                 ' the cost of an TABLE ACCESS FULL operation');
      end loop;
    end;
    commit;
    create index demo_idx on demo(col1,col2,col3,col4) reverse;
    exec dbms_stats.gather_table_stats(USER, 'DEMO', cascade=>true, -
      method_opt=>'FOR ALL COLUMNS SIZE 254', no_invalidate=>false) Any comments are welcome ! Best Regards,
    Gregory
    Message was edited by:
    arkzoyd... I've added the "pre" tags

    I suspect this has something to do with db_file_multiblock_read_count
    After running provided creation statements by you I got following results:
    SQL> show parameter multiblock
    NAME                                 TYPE        VALUE
    db_file_multiblock_read_count        integer     16
    SQL> set autotrace on
    SQL> select count(distinct col5)
      2   from demo
      3   where col1 between 1 and 50000
      4   and col2=col1
      5   and col3=col1
      6   and col4=col1
      7  /
    COUNT(DISTINCTCOL5)
                      1
    Execution Plan
    Plan hash value: 2072716547
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     1 |   116 |   375   (1)| 00:00:05 |
    |   1 |  SORT GROUP BY     |      |     1 |   116 |            |          |
    |*  2 |   TABLE ACCESS FULL| DEMO |     1 |   116 |   375   (1)| 00:00:05 |
    Predicate Information (identified by operation id):
       2 - filter("COL2"="COL1" AND "COL3"="COL1" AND "COL4"="COL1" AND
                  "COL1"<=50000 AND "COL2"<=50000 AND "COL3"<=50000 AND "COL4"<=5000
    0 AND
                  "COL1">=1 AND "COL2">=1 AND "COL3">=1 AND "COL4">=1)
    Statistics
            196  recursive calls
              0  db block gets
           1734  consistent gets
            850  physical reads
              0  redo size
            422  bytes sent via SQL*Net to client
            385  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              7  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> select /*+ index(demo demo_idx)*/ count(distinct col5)
      2   from demo
      3   where col1 between 1 and 50000
      4   and col2=col1
      5   and col3=col1
      6   and col4=col1
      7  /
    COUNT(DISTINCTCOL5)
                      1
    Execution Plan
    Plan hash value: 189561699
    | Id  | Operation                    | Name     | Rows  | Bytes | Cost (%CPU)| T
    ime     |
    |   0 | SELECT STATEMENT             |          |     1 |   116 |   431   (1)| 0
    0:00:06 |
    |   1 |  SORT GROUP BY               |          |     1 |   116 |            |
            |
    |   2 |   TABLE ACCESS BY INDEX ROWID| DEMO     |     1 |   116 |   431   (1)| 0
    0:00:06 |
    |*  3 |    INDEX FULL SCAN           | DEMO_IDX |     1 |       |   430   (1)| 0
    0:00:06 |
    Predicate Information (identified by operation id):
       3 - filter("COL2"="COL1" AND "COL3"="COL1" AND "COL4"="COL1" AND
                  "COL1"<=50000 AND "COL2"<=50000 AND "COL3"<=50000 AND "COL4"<=5000
    0 AND
                  "COL1">=1 AND "COL2">=1 AND "COL3">=1 AND "COL4">=1)
    Statistics
              1  recursive calls
              0  db block gets
          50426  consistent gets
            428  physical reads
              0  redo size
            422  bytes sent via SQL*Net to client
            385  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
              1  rows processedNow I modify multiblock_read_count and full scan cost is going up although anyway Oracle by default chooses full scan instead of index access.
    SQL> alter session set db_file_multiblock_read_count = 8;
    Session altered.
    SQL> select count(distinct col5)
      2   from demo
      3   where col1 between 1 and 50000
      4   and col2=col1
      5   and col3=col1
      6   and col4=col1
      7  /
    COUNT(DISTINCTCOL5)
                      1
    Execution Plan
    Plan hash value: 2072716547
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     1 |   116 |   463   (1)| 00:00:06 |
    |   1 |  SORT GROUP BY     |      |     1 |   116 |            |          |
    |*  2 |   TABLE ACCESS FULL| DEMO |     1 |   116 |   463   (1)| 00:00:06 |
    Predicate Information (identified by operation id):
       2 - filter("COL2"="COL1" AND "COL3"="COL1" AND "COL4"="COL1" AND
                  "COL1"<=50000 AND "COL2"<=50000 AND "COL3"<=50000 AND "COL4"<=5000
    0 AND
                  "COL1">=1 AND "COL2">=1 AND "COL3">=1 AND "COL4">=1)
    Statistics
              1  recursive calls
              0  db block gets
           1697  consistent gets
            850  physical reads
              0  redo size
            422  bytes sent via SQL*Net to client
            385  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> select /*+ index(demo demo_idx)*/ count(distinct col5)
      2   from demo
      3   where col1 between 1 and 50000
      4   and col2=col1
      5   and col3=col1
      6   and col4=col1
      7  /
    COUNT(DISTINCTCOL5)
                      1
    Execution Plan
    Plan hash value: 189561699
    | Id  | Operation                    | Name     | Rows  | Bytes | Cost (%CPU)| T
    ime     |
    |   0 | SELECT STATEMENT             |          |     1 |   116 |   431   (1)| 0
    0:00:06 |
    |   1 |  SORT GROUP BY               |          |     1 |   116 |            |
            |
    |   2 |   TABLE ACCESS BY INDEX ROWID| DEMO     |     1 |   116 |   431   (1)| 0
    0:00:06 |
    |*  3 |    INDEX FULL SCAN           | DEMO_IDX |     1 |       |   430   (1)| 0
    0:00:06 |
    Predicate Information (identified by operation id):
       3 - filter("COL2"="COL1" AND "COL3"="COL1" AND "COL4"="COL1" AND
                  "COL1"<=50000 AND "COL2"<=50000 AND "COL3"<=50000 AND "COL4"<=5000
    0 AND
                  "COL1">=1 AND "COL2">=1 AND "COL3">=1 AND "COL4">=1)
    Statistics
              1  recursive calls
              0  db block gets
          50426  consistent gets
              0  physical reads
              0  redo size
            422  bytes sent via SQL*Net to client
            385  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
              1  rows processedSo I don't know what is the default value of dbfmbrc in XE and not gone too deep to understand how for example system statistics may change your situation.
    Gints Plivna
    http://www.gplivna.eu
    P.S. BTW I used Oracle Database 10g Enterprise Edition Release 10.2.0.1.0.
    Message was edited by:
    gintsp
    listened to Williams suggestion :)

  • Is there a way to restrict the number of attempts for a remediated question using advanced actions?

    I have the following slides in my project:
    content slide 1
    content slide 2
    question slide 1
    question slide 2
    Question slide 1 is a question about content slide 1. Question slide 2 is a question about content slide 2. I would like to restrict the total number of attempts to two for each question. If question 1 is answered incorrectly on the first attempt, the learner would be returned to content slide 1 for review. Clicking the next button will take the learner back to the missed quiz question and allow them a second attempt to answer it correctly. If they answer it incorrectly again, it is scored as incorrect and the learner is taken to question slide 2.
    Can this be done or does remediation keep repeating until the learner answers the question correctly?
    If that is the case, can I achieve my objective by using advanced actions? And, if so, can you provide step by step instructions on how to do this?

    I think it could be possible, but giving you step-by-step instructions, sorry, that would take a lot of time. Did you use advanced actions already? My archived blog has a lot of use cases and tutorials, but I think it is not fair to ask on a forum for step-by-step instructions for each use case you want to create.  The most important thing will be to make sure that the user always remains in the Quiz scope, you can use the new system variable cpInQuizScope while testing. There is no system variable for attempts on question level, only one on Quiz level, so you'll have to create a user variable to track the attempts on question level. A big problem is that when you leave a question slide, without using the remediation work flow, the attempts are considered as finished. Personally I would prefer for that reason to not use the default question slides. You could try out a combination of remediation and advanced actions, never did test that?
    Lilybiri

Maybe you are looking for

  • Cannot copy itunes from one external hard drive to another.

    I have been using an external hard drive for storing my itunes and iphoto for a while now. I have never experienced any issue copying it to a larger drive for back up. My current drive is only 80 gigs (LaCie) and is almost out of space. I bought a ne

  • Is there a way to change a volume license to individual license?

    I've recently upgrade all 11 of our licenses from CS5.5 to CS6, the boxed licenses worked no probs but the volume license did not. After chatting to support they informed me that the volume license will have to be upgraded by that department and the

  • PHP+MySQL query with empty value

    Hi! Software is DW8 with Apache 2.0.48, MySQL ver. 4.0.15a, PHP 4.2.3. We had problem when a submitted value for 'regionID' in the submit page was left blank and the following error message appears in the result page: "You have an error in your SQL s

  • Critacal Cyrus DB Errors After Upgrade

    Hello Cyrus Fans, After 4 Years and Multiple OS Upgrades, I have a serious problem. My users mail stores have suddenly dissappeared. I tried using the only tools available to the GUI: Reconstruct Button, and Restore Button. The LOG Reports: Aug 16 03

  • How to change the name of External Hard Disk?

    I am new to Mac so if this is really easy and I am being completely lame here please excuse me. I have an External Hard Drive that is being used by Time Machine. I don't want to see it on the desktop so I was going to change the name so it had a '.'