Function Index problem.

Hello

I have a problem regarding a function function index.

example:

TableName: Test

Column: A, B, C, D

I create the index on the table, column, a test using a user-defined function.

If I do a select on the column, he'll be fine. In other words, I'll get the results you want.

However, if I insert in the table and validation, and I do a query using the 'A' column in the where clause. I don't have any query hits. Its really weird.

Have you ever experienced this problem? and is there an index of function according to back and donts w.r.t.?

Thank you.

MichaelR

If you use a deterministic function really, it works:

create or replace function test_fn (p_number number) return number deterministic
is
  vreturn number := 0;
begin
  if p_number = 1 then vreturn := 55; end if;
  if p_number = 2 then vreturn := 89; end if;
  return vreturn;
end;

Or, if you reverse the order of your second inserts (insert the folder before the recording of test1 test2) - it works fine.

The reason why you get no results is when you insert the file test1 with a = 2, Oracle executes the function and gets no data, so it assumes that the result is NULL and puts in the index. You said Oracle function is deterministic, so he starts from the principle that any time test_fn (2) is called, it retrieves a null response.

Tags: Database

Similar Questions

  • Spotlight indexing problems

    I cleaned files on my hard drive - re-filing of certain documents (pdf files) rename photos - adding text says pictures of things like that.

    Have had occasional problems with gel - startup etc - that only seem to happen after a cleaning.

    By checking newspapers led to a finder error - saying his flight, or a job did not finish before the closure.

    Never really used it yesterday and it deleted all the files the search-, but if it ends up falling on indexing - or anyway to clear it.

    I was wondering if the problem is that indexing never delete old stuff - maybe the problem after snow leopard from is that the re-indexing after each update is in fact eventually causing an overflow (leak) because the size of some user data was not provided (or someone to pull).

    I'm on snow leopard on a Mac Pro 2008.

    Update on this problem...

    If you are looking for articles on how Spotlight indexing problems - other sites of mac users - OSXdaily, for example - to have discussions on this topic, including advice on how to use a statement in a terminal to turn it off completely - the problems are similar to those that I have - then it's perhaps a question that has not been reported to Apple.

    My problem seems to be a combination of chaining a large number of files and moving them - combined with Time Machine.   I have restore a plu Time Machine folder which contained 1200 small pdf files - which lost some how because of permission issues when I moved them.    As well as readonly files I could not restore them unless I put them in the box and then changed all the permissions read and write.   The older folder was actually the first time machine upward when the main folder in question had been copied from the CD for the office (he gave no permission to write to the subfolders in the main but to load data)

    My time machine is now stopped and I ejected the drive until I decide how to restart backup.

  • Function Index

    I'm reviewing an existing table in a database Oracle 11g and I do not understand a function based index that was created. The syntax is less than

    CREATE INDEX abc. Orders_Date on abc. ORDERS

    (CASE WHERE "ORDER_DATE" IS NOT NULL THEN "ORDER_DATE" ELSE NULL END)

    LOGGING;

    This table has about 90 000 lines with 32 000 values distinct order_date, 3000 lines have order_dates null. When you run a query on this table using the order_date column it makes a full table scan.

    What does this function index based? because I do not see how it adds all the required features

    Thank you

    As others have said, this index is actually right on order_date, however, is a core function so it cannot be used in queries that use CASES WHEN "ORDER_DATE" IS NOT NULL THEN END NO OTHER "ORDER_DATE."

    It is assumed that it might be possible that there is an index on (order_date) but it was found that it was used in the sql queries, which would have preferred to use other indexes. Some queries benefits so maybe that option based function was created as the sql must refer to the phrase exactly, requests that have received have been rewritten and others were left so that they could avoid the new index of the index.

    Of course, if this were the case then maybe you can take a look at your stats.

  • Based on a function index

    Hi all

    Based on a function index are recommended to sql queries slow poor acceleration?


    Thank you

    Kinz

    The only thing that a function index based (FBI) is intended is so you don't lose the use of an index when you call a function in your WHERE (predicate) clause.

    Not sure, I would say it was "the only thing"...

    How about you, the ability to provide access to a very small percentage of rows that match a certain condition (using DECODE or CASE) effective index?

  • CBO bug or not, or else develop do not consider the function index

    SQL> create table test_fun_or as select object_id+sysdate id,object_name from        
    
      2  dba_objects;
    
    Table created.
    
    SQL> create index i_test_fun_or on test_fun_or(id,'a') nologging;   
    
    //I don't know why oracle consider it as function index
    
    Index created.
    
    SQL> create index i_test_fun_or_1 on test_fun_or(object_name) nologging;
    
    Index created.
    
    SQL> set autot trace exp
    
    SQL> exec dbms_stats.gather_table_stats(user,'TEST_FUN_OR',estimate_percent=>null,method_opt=>'for all columns size 1');
    
     
    
    PL/SQL procedure successfully completed.
    
     
    
    SQL> select * from test_fun_or where id=sysdate or object_name='aa';
    
     
    
    Execution Plan
    
    ----------------------------------------------------------
    
    Plan hash value: 3247456674
    
     
    
    ---------------------------------------------------------------------------------
    
    | Id  | Operation         | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
    
    ---------------------------------------------------------------------------------
    
    |   0 | SELECT STATEMENT  |             |     3 |    87 |   219   (3)| 00:00:03 |
    
    |*  1 |  TABLE ACCESS FULL| TEST_FUN_OR |     3 |    87 |   219   (3)| 00:00:03 |
    
    ---------------------------------------------------------------------------------
    
     
    
    Predicate Information (identified by operation id):
    
    ---------------------------------------------------
    
     
    
       1 - filter("OBJECT_NAME"='aa' OR "ID"=SYSDATE@!)
    
     
    
    SQL> select /*+ use_concat */ * from test_fun_or where id=sysdate or object_name='aa'; 
    
    //or expand don't use index i_test_fun_or
    
     
    
    Execution Plan
    
    ----------------------------------------------------------
    
    Plan hash value: 3161566054
    
     
    
    ------------------------------------------------------------------------------------------------
    
    | Id  | Operation                    | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    
    ------------------------------------------------------------------------------------------------
    
    |   0 | SELECT STATEMENT             |                 |     3 |    87 |   224   (3)| 00:00:03 |
    
    |   1 |  CONCATENATION               |                 |       |       |            |          |
    
    |*  2 |   TABLE ACCESS FULL          | TEST_FUN_OR     |     1 |    29 |   219   (3)| 00:00:03 |
    
    |*  3 |   TABLE ACCESS BY INDEX ROWID| TEST_FUN_OR     |     2 |    58 |     5   (0)| 00:00:01 |
    
    |*  4 |    INDEX RANGE SCAN          | I_TEST_FUN_OR_1 |     2 |       |     3   (0)| 00:00:01 |
    
    ------------------------------------------------------------------------------------------------
    
     
    
    Predicate Information (identified by operation id):
    
    ---------------------------------------------------
    
     
    
       2 - filter("ID"=SYSDATE@!)
    
       3 - filter(LNNVL("ID"=SYSDATE@!))
    
       4 - access("OBJECT_NAME"='aa')
    
     
    
    SQL> drop index i_test_fun_or;
    
     
    
    Index dropped.
    
     
    
    SQL> create index i_test_fun_or on test_fun_or(id,object_name) nologging;
    
     
    
    Index created.
    
     
    
    SQL> alter table test_fun_or modify object_name not null;
    
     
    
    Table altered.
    
     
    
    SQL> select /*+ use_concat */ * from test_fun_or where id=sysdate or object_name='aa';
    
     
    
    Execution Plan
    
    ----------------------------------------------------------
    
    Plan hash value: 1705821130
    
     
    
    ------------------------------------------------------------------------------------------------
    
    | Id  | Operation                    | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    
    ------------------------------------------------------------------------------------------------
    
    |   0 | SELECT STATEMENT             |                 |     3 |    87 |     8   (0)| 00:00:01 |
    
    |   1 |  CONCATENATION               |                 |       |       |            |          |
    
    |*  2 |   INDEX RANGE SCAN           | I_TEST_FUN_OR   |     1 |    29 |     3   (0)| 00:00:01 |
    
    |*  3 |   TABLE ACCESS BY INDEX ROWID| TEST_FUN_OR     |     2 |    58 |     5   (0)| 00:00:01 |
    
    |*  4 |    INDEX RANGE SCAN          | I_TEST_FUN_OR_1 |     2 |       |     3   (0)| 00:00:01 |
    
    ------------------------------------------------------------------------------------------------
    
     
    
    Predicate Information (identified by operation id):
    
    ---------------------------------------------------
    
        2 - access("ID"=SYSDATE@!)
    
       3 - filter(LNNVL("ID"=SYSDATE@!))
    
       4 - access("OBJECT_NAME"='aa')

    Jinyu wrote:
    Thanks Jonathan, I don't have 11.2.0.2 on-site, I'll test it later, I just test it on 11.2.0.1

    If you see the notes of fixed a bug fixes for 11.2.0.2 Group (Doc ID:1179583.1) it's bug 8352378 "allow index GOLD-Expansion functions.

    Concerning
    Jonathan Lewis

  • Another key or a function Index Question

    Hello

    I have the following sample tables:
    CREATE THE TABLE1 TABLE:
    (
    NUMBER OF RESOURCE_KEY
    CONSTRAINT TABLE_PK
    KEY ELEMENTARY SCHOOL
    (RESOURCE_KEY)
    )
    /
    CREATE THE TABLE2 TABLE
    (
    RESOURCE2_KEY INTEGER NOT NULL,
    RESOURCE1_KEY INTEGER NOT NULL,
    CONSTRAINT TABLE2_PK
    UNIQUE (RESOURCE2_KEY, RESOURCE1_KEY)
    USING INDEX
    TABLESPACE TRACERT_DATA,
    CONSTRAINT TABLE1_FK1
    FOREIGN KEY (RESOURCE1_KEY)
    REFERENCES TABLE1 (RESOURCE_KEY)
    ON DELETE CASCADE,
    CONSTRAINT TABLE1_FK2
    FOREIGN KEY (RESOURCE2_KEY)
    REFERENCES TABLE1 (RESOURCE_KEY)
    ON DELETE CASCADE
    )
    /
    Insert into TABLE1
    (RESOURCE_KEY)
    Values
    (1) ;
    Insert into TABLE1
    (RESOURCE_KEY)
    Values
    (2) ;
    COMMIT;


    Now comes the tricky part. I want only one of the following inserts to work:
    Insert into TABLE2
    (RESOURCE2_KEY, RESOURCE1_KEY)
    Values
    (1, 2);
    Insert into TABLE2
    (RESOURCE2_KEY, RESOURCE1_KEY)
    Values
    (2: 1);
    COMMIT;


    Any suggestions?

    You can use a single function index based.

    SQL> create table t (x number, y number);
    
    Table created.
    
    SQL> create unique index t_idx on t (greatest(x, y), least(x,y));
    
    Index created.
    
    SQL> insert into t values (2, 1);
    
    1 row created.
    
    SQL> insert into t values (1, 2);
    insert into t values (1, 2)
    *
    ERROR at line 1:
    ORA-00001: unique constraint (TEST.T_IDX) violated
    
    SQL> rollback;
    
    Rollback complete.
    
    SQL> insert into t values (1, 2);
    
    1 row created.
    
    SQL> insert into t values (2, 1);
    insert into t values (2, 1)
    *
    ERROR at line 1:
    ORA-00001: unique constraint (TEST.T_IDX) violated
    
  • z-index problem (I think)

    Hi all

    I have a simple image (x 6 photos) click swap. I have 3 columns, left and Center with the image swap and they work fine, but the right column I can't make it work. I suspect that maybe it's the z-index?

    Would appreciate someones help please.

    HTML

    "" "" < div id = "imageContainer-right" > < img class = src="templates/horme2/images/andrew_balemi_1.jpg 'active'" alt = "01" width = "388" height = "306" / > < img class = src="templates/horme2/images/andrew_balemi_2.jpg 'active'" alt = "01" width = height '388' = "306" / > < img class = src="templates/horme2/images/bruce_fergusson_1.jpg 'active'" alt = "01" width = height '388' = "306" / > < img class = src="templates/horme2/images/bruce_fergusson_2.jpg 'active'" alt = "01" width = "388" height = "306". "" > < img class = 'active' src="templates/horme2/images/lindsay_hooke_2.jpg ' alt = '01' width = '388' height = '306' / > < img class = src="templates/horme2/images/peter_hargreaves_3.jpg 'active' "alt ="01"width ="388"height ="306"/ > < / div >

    < / div >

    CSS

    {#imageContainer right

    Width: 100%;

    height: 306px;

    position: relative;

    overflow: hidden;

    }

    #imageContainer-right img {}

    position: absolute;

    top: 0;

    left: 0;

    z index: 6;

    cursor: pointer; cursor: hand

    }

    {img.active #imageContainer - right

    z-index: 1;

    }

    jQuery

    < script type = "text/javascript" >

    var imageObject = {}

    clickSwap: {function (obj.)}

    {obj. Click (Function ()})

    London var = $(this) .children ('img.active');

    activeImage.removeClass ('active');

    If (activeImage.next () .length > 0) {}

    activeImage.next () .addClass ('active');

    } else {}

    $(this).children('img:first-child').addClass ('active');

    }

    Returns false;

    });

    }

    };

    {$(function()}

    imageObject.clickSwap ($('#imageContainer-right'));

    });

    < /script >

    Thanks for the reply Nancy O,

    I have solved the problem, I was using the class "active" to all images when it should appear on the first frame.

    The site is now on a test server, would appreciate your thoughts, please go here: Homepage

    See you soon

  • query not given function function index in oracle 11g

    I have a query that uses function based indexes when run in oracle 9i, but when I run the same query
    without any change, it does not consider the index. This 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
    MEETING, patient_role
    WHERE patient_role.patient_role_key = encounter.patient_role_key
    AND SUPERIOR (TRIM (main: encounter.account_number SYS_B_0)) = UPPER (TRIM (main: SYS_B_1 of))
    ((: SYS_B_2))
    AND patient_role.discontinued_date IS null
    AND encounter.discontinued_date IS null;

    Definition of the index:

    CREATE INDEX "user1". "' IX_TRIM_ACCOUNT_NUMBER ' ON 'user1 '. MEETING"(AT THE TOP (TRIM (LEADING))
    ('0' TO 'ACCOUNT_NUMBER')), 'PATIENT_ROLE_KEY', 'DOMAIN_KEY', 'DISCONTINUED_DATE')
    PCTFREE, INITRANS 10 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    DEFAULT USER_TABLES)
    TABLESPACE "user1".

    Database: Oracle 11g (11.2.0.3)
    O / s: 64-bit Linux (the query does not consider the index even on the windows operating system)

    Any suggestions?

    -Onkar

    Published by: onkar.nath on July 2, 2012 15:32

    Onkar,

    I don't appreciate posting you this issue in several forums at the same time.
    If I know you also posted this on Asktom, I wouldn't even bother.
    As for your "problem":
    First of all: some kind cursor_sharing MUST have been implemented. Oracle is a predictable system, not a fruitmachine.
    Anyway, your statement that '0' is replaced by a variable binding is simply false. If you really believe this isn't fake, SUBMIT an SR.

    But your real problem isn't Oracle: it is your 'application', which is a mess anyway. Allowing for alphanumeric numbers is a very bad idea.
    Now, you already put workaround on workaround on workaround on workaround.
    Question is this: it is terminal, and you must either to kill him or to replace it.

    -------------
    Sybrand Bakker
    Senior Oracle DBA

  • Determine the column name involved in functional index

    I write this query for existing indexes for all tables refers to a schema. My problem is when index is functional, column name is not descriptive, it's like SYS_NC00047$,... as long as yet I could not find a way to know the exact column name in the out put of this query. your help is needed...
     SELECT index_owner,
             index_name,
             table_owner,
             table_name,
             column_name,
             column_position,
             column_length
        FROM dba_ind_columns
       WHERE index_owner = 'CORE_BUSINESS'
    ORDER BY table_name               ;

    Use DBA_IND_EXPRESSIONS or USER_IND_EXPRESSIONS.

    See this example:

    SQL> drop table X_1 purge;
    
    Table dropped.
    
    SQL>  create table X_1 (col_1  varchar2(5), col_2 number);
    
    Table created.
    
    SQL> create index X_1_UPPER_COL_1 on X_1(upper(col_1));
    
    Index created.
    
    SQL> set long 20000
    SQL> select column_expression from user_ind_expressions
      2  where index_name = 'X_1_UPPER_COL_1';
    
    COLUMN_EXPRESSION
    --------------------------------------------------------------------------------
    UPPER("COL_1")
    
    SQL>
    

    Note: COLUMN_EXPRESSION is a type of data LONG and LONG default MIS to 80 in SQLPlus, so it will show only the first 80 characters of the expression, unless you SET a higher value for a long TIME.

    Hemant K Collette

  • SQL tuning advisor recommnds to create the function SYS_OP_C2C function index

    I have a large table and an index on it. I use a tool to fill data, this simple tool submits the sql for Oracle DB and it does NOT index to use for requests. When I run the sql tuning advisor, he recommends to create additional indexes and use the SYS_OP_C2C function, which I don't want.

    When I run the query through sql plus picks it up in the index.
    Someone of you came, why its recommend that additional nonsense?

    create index abc.xxxx on this_table (SYS_OP_C2C ("this_column"));

    Thank you

    The internal Oracle SYS_OP_C2C function perform the conversion of a set of characters to another set of characters - C (haracterSet) 2 c (haracterSet). There are situations where you will see this conversion without explicit, as in this case command that should be a sign that the data types are not the same and the implicit conversion takes place and this could also be a problem from the point of view performance because it can disable the use of the index.

    Make sure you the characterset and nls set of all of the database and the tool are the same.
    Make sure that the data type of the column in the index is the same as the database.
    Confirm the ETL vendor for your database support and fixes, etc..

    Optimizer will only advise to use this function when the data type or the character set does not match.

    Thank you
    Kerry

  • CS4/JS: generate index problems

    Hello scripters.

    In fact, I have a problem with the generation of my index finger.

    The index already exists, the only thing to do with the script is to generate and place.

    When you run the script, I get the following error message:

    invalid parameter line: myIndex.generate (myIndexPage, [myY1, myX1, myY2, myX2] myLayer, true, true);

    function generateIndex() {}
    myIndex = myDocument.indexes var [0];
    var myMasterSpread = myDocument.masterSpreads.item("A-Mustervorlage");
    var myIndexPage = myDocument.pages.add (LocationOptions.AT_END, myMasterSpread);
    myLayer var = myDocument.activeLayer;
    var myBounds = myGetBounds (myDocument, myIndexPage);
    var myY1 = Math.round(myBounds[0]);
    var myX1 = Math.round(myBounds[1]);
    var myY2 = Math.round(myBounds[2]);
    var myX2 = Math.round(myBounds[3]);
    myIndex.generate (myIndexPage, [myY1, myX1, myY2, myX2] myLayer, true, true);

    }

    I checked all the settings, they're right.

    What else could be wrong?

    Thanks in advance for any help.

    Hi Franziska,

    You must define a place point with an array of two values instead of geometric with an array of four values limits - as you did:

    var myStory = myIndex.generate(myIndexPage, [myY1, myX1], myLayer, true, true);
    

    This generates a new history of the index.

    Later, you can do something with the textContainers of the new history of the index (for example to specify geometric limitations).

    Martin

  • Why cannot avoid the sort ORDER BY STOPKEY function index

     
    
    SQL> alter session set nls_language=american;
    
    Session altered.
    
    SQL> create table test_sort(name,object_name) as select 'select',object_name from 
      2  dba_objects;
    
    Table created.
    
    SQL> create index i_test_sort_1 on test_sort(substr(name,0,3),object_name);
    
    Index created.
    
    SQL> exec dbms_stats.gather_table_stats(user,'TEST_SORT');
    
    PL/SQL procedure successfully completed.
    
    SQL> set autot trace
    SQL> select * from (select * from test_sort where substr(name,0,3)='sel' order by 
      2  object_name) where rownum<11;
    
    10 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 4202652051
    
    --------------------------------------------------------------------------------
    -------------
    
    | Id  | Operation               | Name      | Rows  | Bytes |TempSpc| Cost (%CPU
    )| Time     |
    
    --------------------------------------------------------------------------------
    -------------
    
    |   0 | SELECT STATEMENT        |           |    10 |   740 |       |   504   (3
    )| 00:00:07 |
    
    |*  1 |  COUNT STOPKEY          |           |       |       |       |
     |          |
    
    |   2 |   VIEW                  |           | 49902 |  3606K|       |   504   (3
    )| 00:00:07 |
    
    |*  3 |    SORT ORDER BY STOPKEY|           | 49902 |  1559K|  3928K|   504   (3
    )| 00:00:07 |
    
    |*  4 |     TABLE ACCESS FULL   | TEST_SORT | 49902 |  1559K|       |    60   (5
    )| 00:00:01 |
    
    --------------------------------------------------------------------------------
    -------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter(ROWNUM<11)
       3 - filter(ROWNUM<11)
       4 - filter(SUBSTR("NAME",0,3)='sel')
    
    
    Statistics
    ----------------------------------------------------------
            139  recursive calls
              0  db block gets
            279  consistent gets
              0  physical reads
              0  redo size
            695  bytes sent via SQL*Net to client
            400  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              5  sorts (memory)
              0  sorts (disk)
             10  rows processed 
    
    sql doesn't choose index ,so I use hint to force oracle choose index
    
    SQL> select * from (select /*+ index(test_sort) */ * from test_sort where substr(name,0,3)='sel'
      2  order by object_name) where rownum<11;
    
    10 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1978014138
    
    --------------------------------------------------------------------------------
    ------------------------
    
    | Id  | Operation                      | Name          | Rows  | Bytes |TempSpc|
     Cost (%CPU)| Time     |
    
    --------------------------------------------------------------------------------
    ------------------------
    
    |   0 | SELECT STATEMENT               |               |    10 |   740 |       |
     22869   (1)| 00:04:35 |
    
    |*  1 |  COUNT STOPKEY                 |               |       |       |       |
                |          |
    
    |   2 |   VIEW                         |               | 49902 |  3606K|       |
     22869   (1)| 00:04:35 |
    
    |*  3 |    SORT ORDER BY STOPKEY       |               | 49902 |  1559K|  3928K|
     22869   (1)| 00:04:35 |
    
    |   4 |     TABLE ACCESS BY INDEX ROWID| TEST_SORT     | 49902 |  1559K|       |
     22424   (1)| 00:04:30 |
    
    |*  5 |      INDEX RANGE SCAN          | I_TEST_SORT_1 | 49902 |       |       |
       278   (1)| 00:00:04 |
    
    --------------------------------------------------------------------------------
    ------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter(ROWNUM<11)
       3 - filter(ROWNUM<11)
       5 - access(SUBSTR("NAME",0,3)='sel')
    
    
    Statistics
    ----------------------------------------------------------
              1  recursive calls
              0  db block gets
          22393  consistent gets
              0  physical reads
              0  redo size
            695  bytes sent via SQL*Net to client
            400  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
             10  rows processed
    
    From the explain ,the sql chooses the index,but SORT ORDER BY STOPKEY  doesn't avoid,so oracle
    must read all rows satisfy substr(name,0,3)='sel' ,the I rewrite the sql as the following,we can see 
    that sort ORDER BY STOPKEY does't happen,so oracle return 10 rows fast. 
    
    SQL> select * from (select /*+ index(test_sort) */ * from test_sort where substr(name,0,3)='sel'
      2  order by substr(name,0,3),object_name) where rownum<11;
    
    10 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 4154852915
    
    --------------------------------------------------------------------------------
    ---------------
    
    | Id  | Operation                     | Name          | Rows  | Bytes | Cost (%C
    PU)| Time     |
    
    --------------------------------------------------------------------------------
    ---------------
    
    |   0 | SELECT STATEMENT              |               |    10 |   740 |     8
    (0)| 00:00:01 |
    
    |*  1 |  COUNT STOPKEY                |               |       |       |
       |          |
    
    |   2 |   VIEW                        |               |    10 |   740 |     8
    (0)| 00:00:01 |
    
    |   3 |    TABLE ACCESS BY INDEX ROWID| TEST_SORT     | 49902 |  1559K|     8
    (0)| 00:00:01 |
    
    |*  4 |     INDEX RANGE SCAN          | I_TEST_SORT_1 |    10 |       |     3
    (0)| 00:00:01 |
    
    --------------------------------------------------------------------------------
    ---------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter(ROWNUM<11)
       4 - access(SUBSTR("NAME",0,3)='sel')
           filter(SUBSTR("NAME",0,3)='sel')
    
    
    Statistics
    ----------------------------------------------------------
              1  recursive calls
              0  db block gets
             11  consistent gets
              0  physical reads
              0  redo size
            695  bytes sent via SQL*Net to client
            400  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
             10  rows processed

    Jinyu wrote:
    Hi, I think that this may be an optimizer bug 10g or flaw optimizer 10 g, although substr (name, 0, 3) = 'salt' is not selective, but oracle can also use indexes to find the top 10 by object_name result order

    Jinyu,

    Indeed, it seems to be a gap in the mode of optimization 10.2 FIRST_ROWS_n. I could reproduce your problem in 10.2.0.4 and watching the 10053 trace, it looks like that the optimizer does not consider the option "Recost for ORDER (with the HELP of indexes)" where you have a composite index based function. It does when using a 'normal' composite index, and it does - as you mentioned - when using the main column in the ORDER BY expression as well. You don't need to use INDEX indicator in this case, moreover, the recosting for ORDER BY then works very well and chooses the index without specified indicators.

    11 g the "recalculate for ORDER BY" appears again in the first place it looks like an obvious limitation / bug of 10.2.0.3/4 at least.

    Kind regards
    Randolf

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

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

  • Satellite 5200: Function key problem

    Hello

    Recently the function keys have stopped working on my satellite 5200. When I now hold the function key and attempt to use one light you, sounds, etc., buttons, nothing happens.

    Any idea settings or what I've done, I need to check.

    Thank you.

    Paul.

    Hello

    I also had similar problems with a Sat5200 from a friend.

    We have a United Nations - and reinstalled the common Modules Toshiba, Toshiba Hotkey utility and Toshiba controls.

    then it worked again!

    Rudi Bye

  • function index() in LabWindows 2013 of the compiler

    LabWindows CVI 2013 compiler complains about the use of the variable global 'index', even if 2010 LabWindows is OK with that. The error is an error that is redefined as LabWindows 2013 confused with an old C library string index function.

    Is there a simple solution for that, instead of rename my variable global 'index' in another name?

    Hello nhd973!

    The behavior that you are experiencing is unfortunately a known issue in CVI 2013 (see section incompatibilities):

    http://www.NI.com/product-documentation/51877/en/

    Around that, the simplest method is to rename your global variable.

    However, there is a back door that you can use, which forces the compiler to LabWindows/CVI to ignore the internal controls. You can change the following configuration for these built-ins registry key:

    HKEY_CURRENT_USER\Software\National Instruments\CVI\13.0\Environment\DisableBuiltIns

    By default, this key value is False . Setting its value on True allows the compiler to LabWindows/CVI ignore builtins, so you should not encounter the error again.

    Best regards!

    -Johannes

  • Indexing problem

    I'm running a state machine in a loop and wish to record the errors that occur and diplay on the fron Panel. Because there are many caases and many mistakes possible I want to make sure that all is displayed something like the following.

    Error of gain coefficient

    Setpoint error

    Response error

    etc, but my problem is that the table of errors only displays an error message and replaces it if another error occurs. I thought that indexing would allow me to 'stack' errors so I see all erros that occurred during my test. The "case"TRUE"in the right lower structure case does nothing with the CR. Any suggestions?... Error writing to a file would be easier?

    No, no, no. You must pass in the table since the shift register. An entry in the table build is connected to one and the other input is connected to the error.

    Have you taken the LabVIEW tutorial or resembled any of the examples? An example that illustrates an instruction box with a shift register and table construction is called "separate table values. It is listed under Fundamentals > tables and classes.

Maybe you are looking for

  • Cannot delete the shortcut

    Hello all,. I have a shortcut on one of my home screens that reads 'stay current with the latest updates of your friend' will not erase. No there is no way to get rid of him? Thank you very much Randy

  • Mac does not see my printer "J611a"?

    Hello I have connected my printer to my router (it shows the name of the correct router if I run a config report), but does not see the printer on my Mac (when it is wireless).  Everything works fine if I connect to my Mac with a USB port. Any advice

  • What is the maximum number of physical processors that are supported by Windows XP?

    What is the maximum number of physical processors that are supported by Windows XP?

  • Create DVD Windows telling Me the edited VOB file does not fit

    Hello I have a problem which is confusing me and maybe someone can be able to explain my problem.  Let me start at the beginning. I had a bunch of VHS tapes of my family I have decided to have transferred to DVD. Now that they are on the DVD, I was h

  • Compare the IP numbers between virtual machines

    We host multiple clusters with the same virtual machine test and development. Only the external name is different:CLUSTER_01, 01-VM001, 01-VM002, etc...CLUSTER_02, 02-VM001, 02-VM002, etc.I need to compare the IP address of the virtual machine betwee