forcing the use of an index

Hello:

I'm trying to force an application to use a primary key (the full index scan) instead of a full table scan, but it doesn't seem to work.  I understand that the cardinality of the table is such that a full table scan is justified, but if I explicitly state that I want to use an index should not the optimizer followed on the instructions?   Please notify.

QL > explain plan set statement_id = 'ooo' for

2 Select / * + INDEX (CLM_DET_FLD_ERR (CLM_DET_FLD_ERR_SID)) * / MAX (clm_det_fld_err_sid)

NPF. CLM_DET_FLD_ERR cdfe

3 where 4 cdfe.clm_det_sid < =)

5. Select MAX (cd.clm_det_sid)

6 of NPF. CLM_DET cd

7 where cd.clm_hdr_sid < =)

8. Select MAX (ch.clm_hdr_sid)

npf.clm_hdr ch 9

10 where ch.fee_rqst_sid < =)

11. Select MAX (fr.fee_rqst_sid)

npf.fee_rqst en 12

where the 13 fr.prcd_dt < = to_date (July 10, 2013 ',' DD/MM/RRRR ')));

He explained.

SQL > @explain

Enter statement_id: ooo

ID PARENT OPERATION OBJECT_NAME

---- ------ ----------------------------------- ------------------------------

0 SELECT STATEMENT

1 AGGREGATE OF TRI 0

2 1 TABLE ACCESS FULL CLM_DET_FLD_ERR

3 SORT 2 AGGREGATES

TABLE ACCESS BY INDEX ROWID CLM_DET 3 4

5 4 INDEX RANGE SCAN N01_CLM_DET

6 5 SORT TOGETHER

7 TABLE ACCESS BY INDEX ROWID CLM_HDR 6

8 7 INDEX RANGE SCAN IDX$ _00002

9 8 SORT TOGETHER

10 TABLE 9 FULL FEE_RQST ACCESS

11 selected lines.

Suspicion must be a) well trained and b) valid to use.

It is allowed to use / * + INDEX (table (col)) * / or / * + INDEX (table, index_name) * / or / * + INDEX (index_name table) * /.

But if you have given an alias of the table in the query, then you must use the alias indication not the name of the table.

Once it is well-formed if it is still "ignored" then probably it is not valid, a common example is due to the possibility of unindexed NULL values.

You should also question why you are referring and whether indicators strategy you use is enough/sensitive:

https://jonathanlewis.WordPress.com/2011/06/08/how-to-hint-1/

Do not be offended, but if you can't structure indicator index properly then please think very carefully continues with manual refinement.

I generally consider as a sign of personal failure when I have to resort to the ripening (perhaps with a few exceptions), even if the cause is out of my will.

Even if you still think that you should mention, then perhaps consider using a vehicle indicators as a PMS reference scenario or a profile of SQL.

Looks like you're just to experience what is good.

But see also the advice in the following threads if you are interested in why a query takes an unexpected plan (except an invalid reference):

HOW to: Validate a query of SQL statement tuning - model showing

When your query takes too long...

Tags: Database

Similar Questions

  • I know how to force the Spotlight for re - index a drive or a folder. But how then do I mail?

    I know how to force the Spotlight for re - index a drive or a folder.

    But how then do I mail? I drag this file to the window?

    Thank you.

    Try re-indexing of mailboxes mailbox. This can take some time if you have a lot of mail.

    Reindex messages           For El Capitan, try looking in V3.

    Reindex messages (2)        See post by Linc Davis

  • Force the use of the index without advice

    Dear all,

    I'm a newbie in the world of oracle.

    I HAD POSTED THIS SAME QUESTION IN SQL AND PLSQL CATEGORY, but thought that I had posted in a wrong category, so I post the same question again here.

    Recently my boss asked me a question about the use of the index.

    He wants to force the index to use if the optimizer chooses not to use it.

    But limitattion is this boat reach the query or the code because it is taken directly by an application that we can not change the code.

    So how is - a can force a query to use index without giving advice.

    It should be for a particular query, it should not apply for all indexes in the database.

    I know a parameter "OPTIMIZER_INDEX_COST_ADJ. If you set this parameter correctly, you can force the optimizer to use index. But it has its own limitations.

    So I want an alternative to this option which can only be applied to a particular query that is run without the use of indicators.

    Because this is my first thread, sorry if I made any mistake by posting the question

    Thank you all in advance

    Kind regards
    Navin Bandi

    Hello

    Have you tried the oracle outlines.

    Concerning
    Anurag

  • Sierra Messages App is forcing the use of the discrete GPU

    Since the update of my mid 2015 15 "MacBook Pro to Sierra, Messages.app requires the use of the discrete GPU and kill my battery time.

    All the world fell on this and if so, have you found a solution?

    Here, even with a MacBook Pro in early 2011... problem seems to be based on the new 'features messages"that you can use in iOS 10.

    From messages app, the internal GPU is used until I get a message with one of these new features to messages. Then the GPU will switch to the discrete GPU AMD and continues to work with him until I left messages app.

  • Firefox OSX 10.7.5 25.0.1 forces the use of default input source, why?

    Hello

    I have not noticed this in previous versions of Firefox, but OSX 10.7.5 25.0.1 version requires the use of the input source by default (e.g. my laptop, instead of the external keyboard connected keyboard).

    All other input devices are grayed out in the language & entry drop-down toolbar when the Firefox application is in short. This does not happen with any other application on my desktop.

    I think that's the question relates to this subject also:

    https://support.Mozilla.org/en-us/questions/977966?ESAB=a & As = AAQ

    See you soon,.

    Sunkai.

    Well, it's a broader issue to do with the question of whether the keyboard drivers that are installed are compatible with 32-bit and 64-bit applications.

    Firefox starts in mode 64-bit OSX by default, and if your keyboard drivers are 32-bit only, then this input source is not usable and is grayed out.

    Discussion of this for the British provisions can be found here:

    http://www.Gyford.com/Phil/writing/2005/11/20/using_a_british.php#c285152

    the British 64 - bit drivers layout can come from here:

    http://Liyang.Hu/OSX-British.XHTML

    If you have problems with your own keyboard, with a provision of another country, you will need to find drivers 64-bit for this layout.

  • force the use of an external gps receiver

    I can force my rx5940 to use an external gps for tomtom navi and/or any other program installed navi

    The built-in receiver is too slow

    Brian

    exactly what I needed thank you will try

    Brian

  • Question about the use of secondary indexes in application

    Hi, I'm a newbie to Berkeley DB. We use Berkeley DB for our application that has tables in the following structure.

    Key to value1 value2
    ------- --------- ----------
    1) E_ID-> E_Attr, A_ID - where A_ID is String for example. A_ID = A1; A2; A3
    -where E_ID is unique but for example A1 or A2 may be part of multiple F_VITA say E1, E3, E5 etc.


    So my question is that it is possible to create secondary indexes on individual items of Value2 (e.g., A1, A2 or A3)?


    Another question, lets say we have two tables

    Key to value1 value2
    ------- --------- ----------
    2) X_ID-> X_Attr, E_ID

    E_ID-> E_Attr, A_ID - where A_ID is String for example. A_ID = A1; A2; A3

    In this case, can create us E_ID as a secondary Index but with primary Table-> E_Attr, A_ID E_ID?

    While X_ID given, we can get the chronogram, E_ID-> E_Attr, table allocation A_ID?

    Don't know if its possible.

    Thanks for reading.

    (1) when talking about data & Index, I was referring to READ ONLY BDB with no. UPDATES where you download entire files allows for example on a weekly basis. In this case, I believe that the data will be stored directly in the tree. It will not be stored in the transaction as such logs. This hypothesis is correct?

    # Storage I is nothing other than a transaction log. Read the white paper, that I mentioned.

    (2) and about the Garbage Collection operation, I meant BDB 'Cache éviction' algorithms. Sorry I have not communicated before.

    I use an LRU algorithm. What do you need exactly to know, that you can not get the doc?

    -mark

  • To force the index

    Hello

    My DB is 10.2.0.4

    I have a HISTORY table that has 4 million documents.
    I have a query which gives 15 lines out of it.
    Index is exactly on the same columns as the where clause.
    My = ALL_ROWS optimizer_mode

    I had read "complete analyses are NOT ALWAYS evil, indexes are NOT ALWAYS good.
    But is it possible to force the query to use the indexes here?
     
    CREATE INDEX history_idx3
      ON history (
        ACCNR,
        ACCERGNR,
        CUSTNR
      )
      STORAGE (
        INITIAL  241664 K
      )
    /
    
    
    SQL> SELECT * FROM HISTORY
    WHERE ACCNR = 1500003
    AND ACCERGNR = 0
    AND CUSTNR = 230530  2    3    4  ;
    
    15 ROWS SELECTED.
    
    ELAPSED: 00:03:41.00
    
    EXECUTION PLAN
    ----------------------------------------------------------
    PLAN HASH VALUE: 3565408272
    
    ------------------------------------------------------------------------------
    | ID  | OPERATION         | NAME     | ROWS  | BYTES | COST (%CPU)| TIME     |
    ------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |          |     1 |   200 | 93050   (2)| 00:18:37 |
    |*  1 |  TABLE ACCESS FULL| HISTORY |     1 |   200 | 93050   (2)| 00:18:37 |
    ------------------------------------------------------------------------------
    
    PREDICATE INFORMATION (IDENTIFIED BY OPERATION ID):
    ---------------------------------------------------
    
       1 - FILTER("CUSTNR"=230530 AND "ACCERGNR"=0 AND
                  TO_NUMBER("ACCNR")=1500003)
    
    
    STATISTICS
    ----------------------------------------------------------
              1  RECURSIVE CALLS
              0  DB BLOCK GETS
         420095  CONSISTENT GETS
         418614  PHYSICAL READS
              0  REDO SIZE
           6266  BYTES SENT VIA SQL*NET TO CLIENT
            492  BYTES RECEIVED VIA SQL*NET FROM CLIENT
              2  SQL*NET ROUNDTRIPS TO/FROM CLIENT
              0  SORTS (MEMORY)
              0  SORTS (DISK)
             15  ROWS PROCESSED

    seems to be ACCNR in the table BACKGROUND is defined as VARCHAR?
    If so, your index is ignored.

    Try this:

    SELECT * FROM HISTORY
    WHERE ACCNR = '1500003'
    AND ACCERGNR = 0
    AND CUSTNR = 230530                                                                                                                                                                                                                                                                                                                                                                                                        
    
  • How to force the screen sharing to use Ethernet 2 port?

    Hello

    I have 3 MacPros connected in my studio. MP1 is the master and I use screen apart to see MP2 and MP3. Now, I bought a very quick switch to connect these 3 between them via the Ethernet Port 2 MP1 and at the same time have the MP1 connected to the internet and printers, servers and so on with 1 Port Ethernet. But this is not possible, because the screen sharing will prefer to use the port where the internet/router is connected.

    When ONLY Ethernet Port 2 is active, screen sharing using this port and it works perfectly, but when turn on again once, 1 Port Ethernet 2 remote Mac loses connection.

    Is there a way to force the screen sharing to use Port Ethernet 2?

    It would be useful:

    NC-port-number-on-Mac-OS-x http://superuser.com/questions/148095/How-to-change-the-default-Screen-Sharing-v

  • Since the last update of Firefox, I don't see a security lock when I connect to my two web sites to secure Bank so am forced to use IE and the two banks said the problem with Firefox, not their systems.

    Since the last update of Firefox (Version 4.0.1) I do not see a security lock when I connect my two web sites to secure Bank so am forced to use Internet Explorer for internet banking. I contacted the St George Bank and the ANZ Bank and both say that the problem with Firefox, not their systems. They advise also strongly me to not perform Internet banking unless the security padlock closed is visible in the window secure. The padlock is not visible when I connect secure site of PayPal. Before the upgrade, this problem did not exist and there is no when I use IE. Firefox is my favorite browser.

    The status bar everything has been redesigned, so now allows you to check if the site is secure the box to the left of the address (green, blue or plain).

    The site identity button | How | Firefox help

    Further discussion on this change mention an add-on, you can use if you really prefer to see a lock:

    Firefox 4 where is the lower right corner of padlock | Firefox Support Forum | Firefox help

  • Satellite C55 - how to force the games to use gforce GPU?

    Hello

    It seems that I have 2 graphics cards on my Satellite C55: a 4000 Intel and a gforce 740 m. I tried to force the games to use the gforce on Panel nvidia configuration, but in the games settings (for example in the Hardware tab of flight simulator 2004), shows only the Intel.

    No idea how to resolve this?

    Thank you

    > it seems that I have 2 graphics cards on my Satellite C55: a 4000 Intel and a gforce 740 m.

    The Intel GPU is part of the Intel
    The nVidia GeForce is the external graphics card and it can be used for the application of strong performance as games

    Check these youtube videos how to do this:
    https://www.YouTube.com/watch?v=WVBEPhE_Osg
    https://www.YouTube.com/watch?v=Zh4HCadTY_A

    You can assign any application to use the dedicated made Intel or nVidia GPU card.
    This can be done in the nvidia Control Panel.

    1. click on start and then Control Panel. Select Classic view in the left side of the window.
    2. double-click on the NVIDIA Control Panel.
    3. click view, and then add the "Run with graphic processor" Option to the context Menu. Close the NVIDIA Control Panel.
    4. right click on the title of the application and select run with GPU. Then, click on NVIDIA processor high performance.

  • Why the feature multiple column indexes using index skip scan?

    Hi all

    I have just been hired by a new company and I explored its database infrastructure. Interestingly, I see several function based indexed column used for all the tables. I found it strange, but they said ' we use Axapta to connect Axapta with Oracle, function index according to should be used to improve performance. Therefore, our DBAs create several indexes of feature based for each table in the database. "Unfortunately, I can not judge their business logic.

    My question is, I just created similar to my local database tables in order to understand the behavior of the function index according to several columns. In order to create indexes of based function (substr and nls_lower), I have to declare the columns as varchars2. Because in my business our DBAs had created a number of columns as a varchar2 data type. I created two excatly same table for my experience. I create miltiple function according to index on the my_first table, and then I create several normal index on the my_sec table. The interesting thing is, index skip scan cannot be performed on more than one basic function index (table my_first). However, it can be performed to normal several index on my_sec table. I hope that I have to express myself clearly.

    Note: I also ask the logic of the rule function based index, they said when they index a column they don't ((column length) * 2 + 1) formula. For example, I want to create indexes on the zip code column, column data type VARCHAR2 (3), so I have to use 3 * 2 + 1 = 7, (substr (nls_lower (areacode), 1, 7). substr (nls_lower ()) notation is used nested for any function function index. I know that these things are very illogical, but they told me, they use this type of implementation for Axapta.

    Anyway, in this thread, my question is reletad to function function with index index skip scan, not logical bussiness, because I can not change the business logic.

    Also, can you please give hints or clues for multiple function based indexes?

    Thanks for your help.


    SQL > create table my_first as select '201' codeZone, to_char (100 + rownum) account_num, dbms_random.st
    Ring name ('A', 10) from dual connect by level < = 5000;

    Table created.

    SQL > create table my_sec as select '201' codeZone, to_char (100 + rownum) account_num, dbms_random.st

    Ring name ('A', 10) from dual connect by level < = 5000;

    Table created.

    SQL > alter table my_first change account_num varchar2 (12);

    Modified table.


    SQL > alter table my_sec change account_num varchar2 (12);

    Modified table.

    SQL > alter table my_first change codeZone VARCHAR2 (3);

    Modified table.

    SQL > alter table my_sec change codeZone VARCHAR2 (3);

    Modified table.

    SQL > create index my_first_i on my_first (substr (nls_lower (areacode), 1, 7), substr (nls_lower (account_num), 1, 15));

    The index is created.

    SQL > create index my_sec_i on my_sec (area code, account_num);

    The index is created.

    SQL > analyze table my_first computing statistics for all columns indexed for all indexes.

    Parsed table.

    SQL > analyze table my_sec computing statistics for all columns indexed for all indexes.

    Parsed table.

    SQL > exec dbms_stats.gather_table_stats (USER, 'MY_FIRST');

    PL/SQL procedure successfully completed.

    SQL > exec dbms_stats.gather_table_stats (USER, 'MY_SEC');

    PL/SQL procedure successfully completed.

    SQL > my_first desc;
    Name                                      Null?    Type
    ----------------------------------------- -------- ----------------------------
    CODEZONE VARCHAR2 (3)
    ACCOUNT_NUM VARCHAR2 (12)
    NAME VARCHAR2 (4000)

    SQL > desc my_sec
    Name                                      Null?    Type
    ----------------------------------------- -------- ----------------------------
    CODEZONE VARCHAR2 (3)
    ACCOUNT_NUM VARCHAR2 (12)
    NAME VARCHAR2 (4000)

    SQL > select * from my_sec where account_num = '4000';


    Execution plan
    ----------------------------------------------------------
    Hash value of plan: 1838048852

    --------------------------------------------------------------------------------
    --------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). TI
    me |

    --------------------------------------------------------------------------------
    --------

    |   0 | SELECT STATEMENT |          |     1.    19.     3 (0) | 00
    : 00:01 |

    |   1.  TABLE ACCESS BY INDEX ROWID | MY_SEC |     1.    19.     3 (0) | 00
    : 00:01 |

    |*  2 |   INDEX SKIP SCAN | MY_SEC_I |     1.       |     2 (0) | 00
    : 00:01 |

    --------------------------------------------------------------------------------
    --------


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

    2 - access ("ACCOUNT_NUM" = '4000')
    Filter ("ACCOUNT_NUM" = '4000')


    Statistics
    ----------------------------------------------------------
    1 recursive calls
    0 db block Gets
    Gets 7 compatible
    0 physical reads
    0 redo size
    543 bytes sent via SQL * Net to client
    384 bytes received via SQL * Net from client
    2 SQL * Net back and forth to and from the client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed

    SQL > select * from my_first where substr (nls_lower (account_num), 1: 25) = '4000';


    Execution plan
    ----------------------------------------------------------
    Hash value of plan: 1110109060

    ------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    ------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT |          |     1.    20.     9 (12) | 00:00:01 |
    |*  1 |  TABLE ACCESS FULL | MY_FIRST |     1.    20.     9 (12) | 00:00:01 |
    ------------------------------------------------------------------------------

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

    1 Filter (SUBSTR (NLS_LOWER ("MY_FIRST". "" "" ACCOUNT_NUM")(, 1, 15) ="4000"
    AND SUBSTR (NLS_LOWER ("ACCOUNT_NUM"), 1, 25) = '4000')


    Statistics
    ----------------------------------------------------------
    15 recursive calls
    0 db block Gets
    Gets 26 consistent
    0 physical reads
    0 redo size
    543 bytes sent via SQL * Net to client
    384 bytes received via SQL * Net from client
    2 SQL * Net back and forth to and from the client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed

    SQL > Select / * + INDEX_SS (MY_FIRST) * / * from my_first where substr (nls_lower (account_num), 1: 25) = '4000';


    Execution plan
    ----------------------------------------------------------
    Hash value of plan: 2466066660

    --------------------------------------------------------------------------------
    ----------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU).
    Time |

    --------------------------------------------------------------------------------
    ----------

    |   0 | SELECT STATEMENT |            |     1.    20.    17 (6) |
    00:00:01 |

    |*  1 |  TABLE ACCESS BY INDEX ROWID | MY_FIRST |     1.    20.    17 (6) |
    00:00:01 |

    |*  2 |   INDEX SCAN FULL | MY_FIRST_I |     1.       |    16 (7) |
    00:00:01 |

    --------------------------------------------------------------------------------
    ----------


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

    1 - filter (SUBSTR (NLS_LOWER ("ACCOUNT_NUM"), 1, 25) = '4000')
    2 - access (SUBSTR (NLS_LOWER ("ACCOUNT_NUM"), 1, 15) = '4000')
    Filter (substr (NLS_LOWER ("ACCOUNT_NUM"), 1, 15) = '4000')


    Statistics
    ----------------------------------------------------------
    15 recursive calls
    0 db block Gets
    857 consistent gets
    0 physical reads
    0 redo size
    543 bytes sent via SQL * Net to client
    384 bytes received via SQL * Net from client
    2 SQL * Net back and forth to and from the client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed

    Check MoS for a bug with the FBI and Skip Scan - it sounds like it could be a bug.

    On 11.2.0.4 with your sample code 10053 trace shows the optimizer whereas an index FULL scan to the point where she should consider an index SKIP scan for "unique table path".

    A person with 12.1.0.1 practice would like to run your test and see if it's fixed in this version.

    Concerning

    Jonathan Lewis

  • Force the VM to use the wired ethernet port instead of wireless

    Hello

    I use ver 9 workstation.  I have my host computer (win 7 64 bit) connected to our network of offices using the connection with wireless computers.

    I use a windows xp based virtual machine image that connects to devices of 3rd party via the ethernet port wired in Bridge mode.

    Is there a way to force the workstation on the use of only the cable connection and don't EVER try to connect via the wireless?

    At the moment I have to disable the wireless for the workstation to access cable port, if the without wire is activated, so you may not see anything on the wired port...

    It also causes headaches with ip address conflicts (3rd devices use the same IP range as our network of offices) if I don't have the VM running and wireless power.

    Any help or advice would be appreciated

    Tim

    Use the virtual network Editor to bind to the target adapter for VMnet0 and set the NIC of the virtual machine to use connected by a bridge.

  • Why the data tablespace is used to rebuild indexes?

    11.2.0.3/RHEL 5.8

    We were doing a REBUILD of Index and we got the following error message. I was under the impression that temporary tablespace is used to index
    Reconstructions. But oracle used the tablespace intended to data (GTMLP_OAT_DATA) for reconstruction, as shown below. This is the expected behavior?
    SQL>   ALTER INDEX IDX_CSD_CLIENT_PROF REBUILD PARALLEL 6;
      ALTER INDEX IDX_CSD_CLIENT_PROF REBUILD PARALLEL 6
    
    ERROR at line 1:
    ORA-12801: error signaled in parallel query server P011, instance tandhwr199:HMKRAP2 (3)
    ORA-30032: the suspended (resumable) statement has timed out
    ORA-01652: unable to extend temp segment by 1024 in tablespace GTMLP_OAT_DATA
    -User is correctly assigned a temporary tbs
    SQL> select username, DEFAULT_TABLESPACE , TEMPORARY_TABLESPACE from dba_users where username = 'GTMLP_01';
    
    USERNAME                       DEFAULT_TABLESPACE             TEMPORARY_TABLESPACE
    ------------------------------ ------------------------------ ------------------------------
    GTMLP_01                    GTMLP_OAT_DATA                 GTMLP_TEMP
    It is true, GTMLP_OAT_DATA had actually run out of space.

    So is my hypothesis tha only temporary with is used for the Index rebuild is bad?

    Yes, your assumption is false. Temporary tablespace will be or could be used for sorting (large kinds) which is one of the steps in create index. Rest of the steps will be in the form of temporary to permanent tablespace segments. Here is your answer:

    Rebuilt indexes use temp or system tablespace tablespace?

  • How to use CSS to force the page to full height?

    I'm trying to use CSS to force the content on the page to full height when the content is not long enough to do the job. After reading several articles on the Web, I put the html, body and articletest selectors at a height and min-height of 100%. But it does not work. The yellow area Brown/inner light should extend almost to the bottom, the the two final colors div should be at the bottom of the browser window...

    http://www.keithpurtell.com/kthings/Test01.htm

    You must make two changes as follows:

    (1) change your CSS for the body to look like the following:

    Body {background-color: #FFFFEE;}  / * a E4D9C2 * /.
    color: #31260F;
    font: 1em "Helvetica Neue", Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    Width: 100%;
    /*height:100%;*/
    height: 100 %}

    (2) change your CSS #main to look like this:

    #main {background-color: #FFFFEE;}
    margin: 0 0 auto;
    Max-width: 1180px;
    min-width: 30em;
    min-height: 100%;
    overflow: hidden;
    position: relative ;}

    This should do the trick.  He made and tested it on my system.  I put the page online if need be!

    Good luck.

Maybe you are looking for