Question on Prefix Indexing preference

Hi,
I tried using the prefix index and substring index preferences in index creation and the results are not produced as expected. Here in my case,
The table has the below records,
id txt
1 coca cola
2 pepsi coca cola
The preference used is
begin
ctx_ddl.create_preference('mywordlist', 'BASIC_WORDLIST');
ctx_ddl.set_attribute('mywordlist','PREFIX_INDEX','TRUE');
ctx_ddl.set_attribute('mywordlist','SUBSTRING_INDEX', 'YES');
end;
CREATE INDEX tmp_sub_test_dmn1_idx ON tmp_sub_test(txt)
INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS
('LEXER en_zz_LEXER_pref WORDLIST mywordlist');
Issuing the below query gets me both the records from the table where i expect only the record coca cola should be dispalyed.
select * from tmp_sub_test where contains (txt,'coca%') > 0
Please help on this.

Once again, Oracle Text is a word-based search. You found both records because both records contain the words "coca". If you want records beginning with the string "coca" then use a LIKE or SUBSTR search.
If you want to do a word-based search but still want to find records where "coca" is the first word, then you need to be a bit creative. See this thread for example:
How to select rows which starts with

Similar Messages

  • Prefix Index and Substing Index not working

    Dear all,
    I'm trying to set the following preference to create my index:
    begin
    ctx_ddl.create_preference('substring_pref', 'BASIC_WORDLIST');
    ctx_ddl.set_attribute('substring_pref','PREFIX_INDEX','TRUE');
    ctx_ddl.set_attribute('substring_pref','PREFIX_MIN_LENGTH',3);
    ctx_ddl.set_attribute('substring_pref','PREFIX_MAX_LENGTH',15);
    ctx_ddl.set_attribute('substring_pref','SUBSTRING_INDEX','TRUE');
    end;
    create index artikel_test_idx
    on artikel_test (art_content)
    indextype is ctxsys.context
    parameters ( 'WORDLIST substring_pref' )
    The index is created sucessfully.
    Here is the data I have in my table:
    ART_INHOUD ART_TITEL ART_CONTENT
    1 Titel1 prion alzheimer
    2 Titel2 prion word1 alzheimer
    3 Titel3 prion word2 word3 alzheimer
    4 Titel4 prion
    5 Titel5 alzheimer
    6 Titel6 alzheimer prion
    7 Titel7 alzheimer word1 prion
    8 Titel8 something else
    9 Titel9 prion alzheimer prion alzheimer
    10 Title10 i am theree
    11 Title11 contract initiation work
    12 Title12 oracle university else
    12 rows selected.
    I test the substring feature by searching for "alz". It should returns me all lines that contains "alzheimer". Am I right? But the result show nothing:
    select art_titel, score(1) as score
    from artikel_test
    where contains (art_content, 'alz', 1) > 0
    no rows selected
    If I search for the entire word, it works:
    select art_titel, score(1) as score
    from artikel_test
    where contains (art_content, 'alzheimer', 1) > 0;
    ART_TITEL SCORE
    Titel9 7
    Titel7 4
    Titel6 4
    Titel5 4
    Titel3 4
    Titel2 4
    Titel1 4
    7 rows selected.
    I look at the table DR$ARTIKEL_TEST_IDX$I and all works are in it:
    TOKEN_TEXT
    ALZ
    ALZH
    ALZHE
    ALZHEI
    ALZHEIM
    ALZHEIME
    ALZHEIMER
    ALZHEIMER
    AM
    CON
    CONT
    CONTR
    CONTRA
    CONTRAC
    CONTRACT
    CONTRACT
    Why there is no result when I search for 'alz'?
    Regards,
    Yanick
    Message was edited by:
    yankee75

    The prefix_index and substring_index do not make the substrings searchable as individual words. They just speed up wildcard queries. If you search for "alt" you will only get rows that have the word "alt" in it. If you search for "alt%" you will get all rows that contain words that begin with "alt". Here are some quotes from the Oracle Text Reference, which is part of the Oracle online documentation:
    "substring_index      Specify TRUE for Oracle Text to create a substring index. A substring index improves left-truncated and double-truncated wildcard queries such as %ing or %benz%. Default is FALSE."
    "prefix_index      Specify TRUE to enable prefix indexing. Prefix indexing improves performance for right truncated wildcard searches such as TO%. Defaults to FALSE."

  • Prefixed index vs. Non-prefixed Index.  Which is faster?

    If you have a partitioned table, which type index (prefix or non-prefix) would benefit most performance wise?

    ji**** wrote:
    If you have a partitioned table, which type index (prefix or non-prefix) would benefit most performance wise?Gllobally partitioned indexes have to start with the partition key - otherwise choose the column order that allows the most important queries to operate most efficiently. The prefix/non-prefix concept for local indexes is a hangover from the earliest days of partitioning.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    A general reminder about "Forum Etiquette / Reward Points": http://forums.oracle.com/forums/ann.jspa?annID=718
    If you never mark your questions as answered people will eventually decide that it's not worth trying to answer you because they will never know whether or not their answer has been of any use, or whether you even bothered to read it.
    It is also important to mark answers that you thought helpful - again it lets other people know that you appreciate their help, but it also acts as a pointer for other people when they are researching the same question, moreover it means that when you mark a bad or wrong answer as helpful someone may be prompted to tell you (and the rest of the forum) what's so bad or wrong about the answer you found helpful.

  • A question related to index

    Hi,
    I have the following question about indexes:
    In our datamodel, we have several columns that are defined as nullable - they contain null data. And yet on these column there is an index defined. Does that help any? - The index are single index index not composite column index. What I understand is that: if a column contains null values then oracle can't use index on it and so the index would not serve any purpose. Is that right?
    Thanks,

    "In my situation we have single key index on a column and that column is nullable. So my understanding is that these single key index on a nullable column does not add any value at all. Is that correct? "
    Yes, as http://oradbatips.blogspot.com/2006/11/tip-8-index-for-null-columns.html the link is saying that if a column which is having null values, will not be in index, i.e. "Index does not store NULL value". So, if whenever you select * from table where column is null; it will go for full table scan... not index scan.. because there is no null in index.
    Regards
    Girish Sharma

  • Question about filtered index

    I am looking over database for the SQL objects having SET QUOTED_IDENTIFIER OFF and SET ANSI_NULLS OFF
    For filtered index both needs to be ON so what about the objects that dont have quoted_identifier and ansi_nulls code line?
    do i need to add SET QUOTED_IDENTIFIER ON and SET ANSI_NULLS ON for those objects as well?

    Following article solved my question
    http://blogs.msdn.com/b/sqlprogrammability/archive/2009/06/29/interesting-issue-with-filtered-indexes.aspx
    I tried creating proc without quoted_identifier and ansi_nulls code line and proc still executes

  • Question about UNIQUE INDEX

    Given a table with 2 columns. They are not setup as UNIQUE.
    TABLE_A (
    column1 NUMBER NOT NULL,
    column2 NUMBER
    Then, a UNIQUE INDEX is created for both of the columns
    CREATE UNIQUE INDEX XX.TABLEA_U ON TABLE_A
    (column1, column2)
    My question is does the above UNIQUE INDEX somehow act as a UNIQUE Constraint to "column1"?
    Thanks in Advance

    It acts as a unique constraint on both the columns.If duplicate row is inserted you will get error like
    05:40:30 sql>create unique index u_a on a (column1,column2);
    05:41:07 sql>insert into a values (1,2);
    1 row created.
    Elapsed: 00:00:00.00
    05:41:12 sql>insert into a values (1,2);
    insert into a values (1,2)
    ERROR at line 1:
    ORA-00001: unique constraint (SYSADM.U_A) violated
    05:41:15 sql>insert into a values (1,3);
    1 row created.
    Elapsed: 00:00:00.00Anand
    Edited by: Anand... on Nov 5, 2009 5:41 AM

  • Question Mark over system Preferences on Doc....

    Hi, well I haven't had my mac long, and today I have a question mark over my system pref icon, and cannot access it. I can't even find it in the apps folder..?
    Does anybody know how to fix this please?
    I have looked and some people suggest a reinstall of OS, which is fine but I have no back ups yet as I haven't had it long and don't even know how to back it up! (Ex PC user...) would I lose all my photos etc in aperture...?
    many thanks in advance

    The question mark means it cannot find System Preferences, which apparently, you can't either.
    Have you looked in the Trash to see if you may have accidentally moved it there?
    There is also a program called Pacifist which will allow you to get individual items out of the installation disks.
    Finally, an Archive and Install with the option to Preserve User and Network settings will save all of your data. However, I wouldn't trust anything. If your photos are important, burn them to a DVD and then do the archive and install.

  • Question about Global index and Table Partitions

    I have created a global index for a partitioned table now in the future the partitions will be dropped in the table. Do I need to do anything to the global index? Does it need to be rebuilt or would it be ok if partitions get dropped in the table?

    >
    I have created a global index for a partitioned table now in the future the partitions will be dropped in the table. Do I need to do anything to the global index? Does it need to be rebuilt or would it be ok if partitions get dropped in the table?
    >
    You can use the UPDATE INDEXES clause. That allows users to keep using the table and Oracle will keep the global indexes updated.
    Otherwise, as already stated all global indexes will be marked UNUSABLE.
    See 'Dropping Partitions' in the VLDB and Partitioning Guide
    http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm#i1007479
    >
    If local indexes are defined for the table, then this statement also drops the matching partition or subpartitions from the local index. All global indexes, or all partitions of partitioned global indexes, are marked UNUSABLE unless either of the following is true:
    You specify UPDATE INDEXES (Cannot be specified for index-organized tables. Use UPDATE GLOBAL INDEXES instead.)
    The partition being dropped or its subpartitions are empty

  • Question about the index and homepages

    Hello all,
    I am new to dreamweaver and I have only had my website for a couple of months now.
    On my site, I have a "Home Page" button that visitors can click to return to the home URL.
    My home URL is: www.djidblends.com
    When users click on the "Home Page" button, they are taken to the URL: www.djidblends.com/index.html
    In the past, whenever I wanted to update my regular home page, I just simply updated the index.html file in dreamweaver... and it worked for both of the URLs listed above.
    However, I recently attempted to update the home page once again, and it did NOT work for both URLs.
    For example, when I visit www.djidblends.com, my page is NOT updated.
    When I click on the "Home Page" button, my page IS updated.
    I have looked around and some people have had the same problem as me, but I haven't found a legit fix for this problem.
    If anyone knows how I can fix this, I would greatly appreciate your help.
    Thanks,
    Bye.

    On my site, I have a "Home Page" button that visitors can click to return to the home URL.
    My home URL is: www.djidblends.com
    When you go to http://www.djidblends.com, the server tries to open pages that are named index.htm, index.html, index.php amongst others. In this case index.html will be opened despite it not showing as such in the address bar.
    When users click on the "Home Page" button, they are taken to the URL: www.djidblends.com/index.html
    That is correct because the Home Page button links to index.html. The reason why it shows in the address bar as http://www.djidblends.com/index.html is because the link is within the www.djidblends.com site. If you click the Contact Information button, the address bar will correspond to the contact.html link.
    In the past, whenever I wanted to update my regular home page, I just simply updated the index.html file in dreamweaver... and it worked for both of the URLs listed above.
    That is correct, you are uploading the page that is linked to the menu.
    However, I recently attempted to update the home page once again, and it did NOT work for both URLs.
    For example, when I visit www.djidblends.com, my page is NOT updated.
    When I click on the "Home Page" button, my page IS updated.
    That is because the browser has a cached copy of your site and it will load the cached copy to save time. When you click the Home Button it may, but not always, refresh the page bypassing the cached version. IE may not respond immediately because it tends to hang onto the cached version of the page much longer.
    I have looked around and some people have had the same problem as me, but I haven't found a legit fix for this problem.
    If anyone knows how I can fix this, I would greatly appreciate your help.
    The problem occurs when someone has paid a visit to your site before the updated page has been uploaded. There are ways to overcome this. For more info have a look here http://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache
    Gramps

  • Question about composite index and index skip scan

    Hi,
    I have a confusion.
    I have read Burleson's post on composite index column ordering (http://www.dba-oracle.com/t_composite_index_multi_column_ordering.htm) where he writes that
    "......for composite indexes the most restrictive column value(the column with the highest unique values) should be put first to trim down the result set..."
    But 10g performance tuning book tells this about INDEX SKIP SCAN ::
    "... Index Skip scanning lets a composite index be split logically into smaller subindexes. In skip
    scanning, the initial column of the composite index is not specified in the query. In other words, it is skipped.
    The number of logical subindexes is determined by the number of distinct values in the initial column.
    Skip scanning is advantageous if there are few distinct values in the leading column of the composite index and many distinct values in the non-leading key of the index......."
    So if we design Composite indexes acc. to what Burleson said then how can we take advantage of index skip scanning. These two staements oppose each other,don't they ?
    Can anybody explain this ?

    Dear,
    For the moment forget the distinct values and the compressibility. I've tried to reproduce your case here below (using jonathan lewis table script)
    create table t1
    as
    with generator as (
        select    --+ materialize
            rownum id
        from dual
        connect by
            rownum <= 10000
    select
        rownum              c1,
        mod(rownum,1000)    c2,
        mod(rownum,5000)    c3,
        mod(rownum,10000)   c4,
        lpad(rownum,10,'0') c5,
        rpad('x',5)         c6
    from
        generator    v1,
        generator    v2
    where
        rownum <= 1000
    alter table t1 add constraint t1_pk primary key (c3,c4,c5,C6);
    create index idx_1 on t1 (c1,c2);
    begin
         dbms_stats.gather_table_stats(
              ownname           => user,
              tabname           =>'T1',
              estimate_percent => 100,
              method_opt       => 'for all columns size 1'
    end;
    /and here are what I got with your two selects
    mho.sql>> SELECT c1,c2
      2  FROM t1
      3  WHERE c2 = 3;
            C1         C2
             3          3
    Elapsed: 00:00:00.00
    mho.sql>> start dispcursor
    PLAN_TABLE_OUTPUT
    SQL_ID  4dbgq3m2utd9f, child number 0
    SELECT c1,c2 FROM t1 WHERE c2 = 3
    Plan hash value: 3723378319
    | Id  | Operation            | Name  | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |*  1 |  INDEX FAST FULL SCAN| IDX_1 |      1 |      1 |      1 |00:00:00.01 |       7 |
    Predicate Information (identified by operation id):
       1 - filter("C2"=3)
    17 rows selected.
    Elapsed: 00:00:00.34
    mho.sql>> SELECT c3,c4,c5,c6
      2  FROM t1
      3  WHERE c4 = 3
      4  AND c5 = '0000000003'
      5  AND c6 = 'x    ';
            C3         C4 C5         C6
             3          3 0000000003 x
    Elapsed: 00:00:00.00
    mho.sql>> @dispcursor
    PLAN_TABLE_OUTPUT
    SQL_ID  fv62c9uqtktw9, child number 0
    SELECT c3,c4,c5,c6 FROM t1 WHERE c4 = 3 AND c5 = '0000000003' AND c6 = 'x    '
    Plan hash value: 2969533764
    | Id  | Operation            | Name  | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |*  1 |  INDEX FAST FULL SCAN| T1_PK |      1 |      1 |      1 |00:00:00.01 |       9 |
    Predicate Information (identified by operation id):
       1 - filter(("C4"=3 AND "C5"='0000000003' AND "C6"='x    '))
    17 rows selected.I didn't succeed to reproduce your index skip scan situation.
    Best Regards
    Mohamed Houri

  • Question about "Spatial Index Advisor"

    I'm now using "Oracle8i Enterprise Edition 8.1.6" and "Oracle8i Enterprise Manager 2.1" for Windows NT/2000. I tried to use the extended administration tool of the Manager "Spatial Index Advisor" to access my spatial data. I can see the layers in the "Add layer" Dialog. But when I want to add a layer, it popup a failed message box said "Server object could not be created:Server object could not be initialized:Not be supported charaterset:oracle-characterset-852". Why? And how can I solve the problem?

    Hi Dinghy,
    The Oracle 8.1.6 sdo advisor is only implemented for the US7ASCII character set.
    The Oracle 8.1.7 release of the advisor does have NLS support.
    Hope this helps. Thanks.
    Dan
    null

  • Question: create index indextype is ctxsys.context whith NOLOGGING

    Dear All,
    I would like to ask a question about
    CREATE INDEX <index_name> ON <table_name> ( <index_col> ) INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS ( ... )maybe you experienced that ctxsys.context index creation takes long time.
    When you create a ctxsys.context index it is obvious to reduce the workload of the RDBMS. In this case I would like to reduce the I/O load with NOLOGGING option.
    Firstly, I try to put the index into a tablespace with no logging option. I don't know why but it is not working. Watching the alert.log file I diagnose that redo log generated simultaneously while index generated (there are no other activity on RDBMS).
    Q1 (optional): Why generating redo on object of NOLOGGING tablaspace ?
    I think there are better solution: use the NOLOGGIN option of the create index command which is very simple to use at column indexes.
    Which unclear to me how should I use in CREATE INDEX .. INDEXTYPE IS CTXSYS.CONTEXT command.
    Fllowing the CREATE INDEX command syntax seems oubvious - but it provides sytax error.
    Maybe this is why CREATE INDEX .. INDEXTYPE IS CTXSYS.CONTEXT needs something different for options: PL/SQL
    example captured (for options):
    begin
    ctx_ddl.create_preference ('mystore', 'BASIC_STORAGE');
    ctx_ddl.set_attribute ('mystore', 'I_INDEX_CLAUSE', 'tablespace users storage (initial 32k) compress 2');
    end;
    CREATE INDEX docs_idx ON my_docs(doc) INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS ('STORAGE mystore');Q: How can I specify NOLOGGING option? In the index command? In the attribute? What is the exact syntax if NOLOGGING is allowed at ctxsys.context?
    Oracle version: 11.1.0.6.0
    Any advice, highly appreciated.
    Istvan

    You have to specify nologging in  storage preference.
    See Avoiding Redo Logging for an Oracle Text Domain Index (Doc ID 432762.1)
    Example:
    begin
    ctx_ddl.drop_preference('my_storage');
    end;
    begin
    ctx_ddl.create_preference('my_storage','BASIC_STORAGE');
    end;
    begin
    ctx_ddl.set_attribute('my_storage', 'i_table_clause','tablespace foo1 storage (initial 5M next 10M pctincrease 0 freelists 24 freelist groups 24) nologging');
    ctx_ddl.set_attribute('my_storage', 'k_table_clause','tablespace foo2 storage (initial 5M next 10M pctincrease 0) nologging');
    ctx_ddl.set_attribute('my_storage', 'r_table_clause','tablespace foo3 storage (initial 5M next 10M pctincrease 0) lob(DATA) store as (nocache nologging) nologging');
    ctx_ddl.set_attribute('my_storage', 'n_table_clause','tablespace foo4 storage (initial 5M next 10M pctincrease 0) nologging');
    ctx_ddl.set_attribute('my_storage', 'p_table_clause','tablespace foo5 storage (initial 5M next 10M pctincrease 0) nologging');
    ctx_ddl.set_attribute('my_storage', 'i_index_clause','tablespace foo6 storage (initial 5M next 10M pctincrease 0) compress 2 nologging');
    end;

  • Question about the partition index

    Hi, all, I have some questions about partitioned index.
    And I get from oracle documents that oracle's partition index can be clarified as local partition index and global partition index.
    And local partition index can be clarified as prefix local partition index and non-prefix local partition index. And I also the word "global prefix partition index".
    But, I can not get what the exact meaning after I consulted many documents and notes from website.
    Can anyone give me one example to cover these topic?
    You help is very thankful!
    Thanks and best regards!

    Hi,
    Local index search by partition.
    Local Indexes: A local index is an index on a partitioned table which is partitioned in the exact same manner as the underlying partitioned table. Each partition of a local index corresponds to one and only one partition of the underlying table.
    Global Partitioned Indexes: A global partitioned index is an index on a partitioned or non-partitioned table which is partitioned using a different partitioning-key from the table. Global-partitioned indexes can only be partitioned using range partitioning. For example, a table could be range-partitioned by month and have twelve partitions, while an index on that table could be range-partitioned using a different partitioning key and have a different number of partitions.
    Global Non-Partitioned Indexes: A global non-partitioned index is essentially identical to an index on a non-partitioned table. The index structure is not partitioned.
    Maybe this links help you:
    http://www.oracle.com/technology/products/oracle9i/datasheets/partitioning.html
    http://asktom.oracle.com/pls/ask/f?p=4950:8:12026637104196321871::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:678824574412
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:1612281449571
    Cheers

  • Index creation -- question

    Hi,
    I have a question about creating indexes for my environment here
    i have a table that gets populated with about 200 million rows everyday.
    my table structure is as follows
    (tab_id,orig_add,orig_nw,dest_add,dest_nw,ts_arrive,ts_leave,status,fn_type,error_code)
    tab_id number
    orig_add varchar2
    dest_add varchar2
    orig_nw number
    dest_nw number
    ts_arrive date
    ts_leave date
    status number -- (0 /1)
    fn_type number -- (0/1/2/3/4/5)
    errorcode -- (about 20 distinct values)
    this table has been partitioned on ts_leave (hourly)
    if i know i am going to be using a lot of queries with the where clause like :
    orig_nw=something and dest_nw=something
    can i have a local index on (orig_nw,dest_nw) ?
    what about fields like status and errorcode and fn_type?, is a bitmap index suited for this?
    while indexes are being created, i will also have to be reminded of the fact that a great number of inserts are being done every second
    Please advise..thanks

    Bitmaps are most beneficial if the status holds something like Booleans
    either False or True , Y or N , 0 or 1 . Not wholly true. Read this article by Jonathan Lewis and enlighten yourself.
    "Forget the vague expressions like "low cardinality." In most cases there are only two points to bear in mind when considering bitmap indexes. First, it is the number of different blocks in the table that you have to visit for a typical index value that is the major cost of using an individual index; changing an index from B*tree to bitmap won't magically make it a better index. Secondly, it is Oracle's optimiser mechanism for combining multiple bitmap indexes that makes them useful."
    Cheers, APC

  • Index question

    hi
    I have created a query on an infoset containing 2 dso and 1 infoobject. My query timed out whn i run it. Can i create an index on the dso and infoobject.
    Index creation on the ods and masterdata infoobject will have any negative effects. Is going to affect the loading performance of the these objects.
    As of now no index are there on these object.
    Please advise
    Regards
    bipower

    Hi,
    The index you created(Function based index) is right. Each time you use index, its performance keeps increasing. Check that.
    Regarding your second question
    'Does an index only work on an schema-based (Structured Mapping) of an XMLType?'
    No. Index can be created on a XMLType column which is not schema-based also.
    We have designed a Survey sample which uses Oracle Text indexes on a XMLType column which is not schema based.
    The sample is located at
    http://otn.oracle.com/sample_code/tech/xml/survey/content.html
    We have used CTXXPATH index present in Oracle Text
    A tutorial on Oracle XML DB is also present at this location. You can check that and try using the index.
    Get back to me if you need furthur help.
    Thank you,
    Anupama

Maybe you are looking for