Scoring messed up using concatenated datastore Index

Hi,
Here is my table structure....
CREATE TABLE SRCH_KEYWORD_SEARCH_SME
SYS_ID NUMBER(10) NOT NULL,
PAPER_NO VARCHAR2(10),
PRODIDX_ID VARCHAR2(10),
RESULT_TITLE VARCHAR2(255),
RESULT_DESCR VARCHAR2(1000) NOT NULL,
ABSTRACT CLOB,
SRSLT_CATEGORY_ID VARCHAR2(10) NOT NULL,
SRSLT_SUB_CATEGORY_ID VARCHAR2(10) NOT NULL,
ACTIVE_FLAG VARCHAR2(1) DEFAULT 'Y' NOT NULL,
EVENT_START_DATE DATE,
EVENT_END_DATE DATE,
Here is the Concatenated Datastore preference...
   -- Drop any existing storage preference.
   CTX_DDL.drop_preference('SEARCH_STORAGE_PREF');
   -- Create new storage preference.
   CTX_DDL.create_preference('SEARCH_STORAGE_PREF', 'BASIC_STORAGE');
      CTX_DDL.set_attribute('SEARCH_STORAGE_PREF', 'I_TABLE_CLAUSE', 'tablespace searchidx');
      CTX_DDL.set_attribute('SEARCH_STORAGE_PREF', 'K_TABLE_CLAUSE', 'tablespace searchidx');
      CTX_DDL.set_attribute('SEARCH_STORAGE_PREF', 'R_TABLE_CLAUSE', 'tablespace searchidx lob (data) store as (disable storage in row cache)');
      CTX_DDL.set_attribute('SEARCH_STORAGE_PREF', 'N_TABLE_CLAUSE', 'tablespace searchidx');
      CTX_DDL.set_attribute('SEARCH_STORAGE_PREF', 'I_INDEX_CLAUSE', 'tablespace searchidx  compress 2');
      CTX_DDL.set_attribute('SEARCH_STORAGE_PREF', 'P_TABLE_CLAUSE', 'tablespace searchidx');
   -- Drop any existing datastore preference.
   CTX_DDL.drop_preference('SEARCH_DATA_STORE');
   CTX_DDL.DROP_SECTION_GROUP('SEARCH_DATA_STORE_SG');
   -- Create new multi-column datastore preference.
   CTX_DDL.create_preference('SEARCH_DATA_STORE','MULTI_COLUMN_DATASTORE');
   CTX_DDL.set_attribute('SEARCH_DATA_STORE','columns','abstract, srslt_category_id, srslt_sub_category_id, active_flag');
   CTX_DDL.set_attribute('SEARCH_DATA_STORE', 'FILTER','N,N,N,N');
   -- Create new section group preference.
   CTX_DDL.create_section_group ('SEARCH_DATA_STORE_SG','BASIC_SECTION_GROUP');
   CTX_DDL.add_field_section('SEARCH_DATA_STORE_SG', 'abstract',              'abstract',             TRUE);
   CTX_DDL.add_field_section('SEARCH_DATA_STORE_SG', 'srslt_category_id',     'srslt_category_id',    TRUE);
   CTX_DDL.add_field_section('SEARCH_DATA_STORE_SG', 'srslt_sub_category_id', 'srslt_sub_category_id',TRUE);
   CTX_DDL.add_field_section('SEARCH_DATA_STORE_SG', 'active_flag',           'active_flag',          TRUE);
Here is the context Index
CREATE INDEX SRCH_KEYWORD_SEARCH_I ON SRCH_KEYWORD_SEARCH_SME(ABSTRACT)
   INDEXTYPE IS CTXSYS.CONTEXT
      PARAMETERS('STORAGE search_storage_pref DATASTORE SEARCH_DATA_STORE SECTION GROUP SEARCH_DATA_STORE_SG' )
Here is the Query # 1 I am trying out...
SELECT /*+ FIRST_ROWS(10) */
       SCORE(1) score_nbr,
       k.SYS_ID,
       k.RESULT_TITLE,
FROM   SRCH_KEYWORD_SEARCH_SME k
WHERE  CONTAINS (k.ABSTRACT, '<query><textquery><progression><seq>{hitchhiker} WITHIN abstract</seq></progression></textquery></query>',1) > 0
ORDER BY SCORE(1) DESC;
Here is the result for Query # 1...
score_nbr   sys_id     result_title
54          99220      SME Releases New Book The Hitchhiker's Guide to Lean                                                                                                                                                                                                     72                                    
43          116583     Lean Leadership Package                                                                                                                                                                                                                                         72                                    
32          132392     The Hitchhikers Guide to Lean: Lessons from the Road                                                                                                                                                                                                           72                                    
11          132017     Lean Manufacturing A Plant Floor Guide Book Summary                                                                                                                                                                                                            72                                    
11          137106     Managing Factory Maintenance, Second Edition                                                                                                                                                                                                                    72                                    
11          132082     Lean Pocket GuideHere is the Query # 2 I am trying out...
SELECT /*+ FIRST_ROWS(10) */
       SCORE(1) score_nbr,
       k.SYS_ID,
       k.RESULT_TITLE,
FROM   SRCH_KEYWORD_SEARCH_SME k
WHERE  CONTAINS (k.ABSTRACT, '<query><textquery><progression><seq>{hitchhiker} WITHIN abstract AND Y WITHIN active_flag</seq></progression></textquery></query>',1) > 0
ORDER BY SCORE(1) DESC
Here is the result for Query # 2...
score_nbr sys_id     result_title
3         132017     Lean Manufacturing: A Plant Floor Guide Book Summary                                                                                                                                                                                                            72                                    
3         137106     Managing Factory Maintenance, Second Edition                                                                                                                                                                                                                    72                                    
3         132082     Lean Pocket Guide                                                                                                                                                                                                                                               72                                    
3         132083     The Toyota Way: 14 Management Principles From the World's Greatest...                                                                                                                                                                                           72                                    
3         132417     Lean Manufacturing: A Plant Floor Guide                                                                                                                                                                                                                         72                                    
3         132091     Breaking the Cost Barrier: A Proven Approach to Managing and...                                                                                                                                                                                                 72                                    
3         99318      Conflicting pairs                                                                                                                                                                                                                                               72                                    
3         132393     One-Piece Flow: Cell Design for Transforming the Production Process                                                                                                                                                                                             72                                    
3         137091     Learning to See: Value Stream Mapping to Create Value & Eliminate MUDA                                                                                                                                                                                          72                                    
3         137090     The Purchasing Machine: How the Top 10 Companies Use Best Practices...                                                                                                                                                                                          72                                    
3         137393     Passion for Manufacturing My question is, why did the scoring went all the way to 3 for ALL the results the above query returned when I used the AND clause
and added the 2nd column used in the datastore for my query condition..
Also I want to use progressive relaxation technique in the queries to use stemming & fuzzy search option too.
Help me out please....
Thanks in advance.
- Richard.

Yes, it's in the doc - it's known as the weight operator.
http://download.oracle.com/docs/cd/B28359_01/text.111/b28304/cqoper.htm#i998379
"term*n      Returns documents that contain term. Calculates score by multiplying the raw score of term by n, where n is a number from 0.1 to 10."
We're just using the operator twice as the limit on "n" is 10 (for no obvious reason I know of!). This is perfectly safe, and common practice.

Similar Messages

  • Concatenated datastores

    I have developed applications around several intermedia indexed text columns, but now would like to create a concatenated datastore indexing those same columns and using sections within new applications. Will my older applications still be able to access the individual intermedia text indexes that are already in place or will I have to modify the older applications to access the new concatenated datastore?

    I have developed applications around several intermedia indexed text columns, but now would like to create a concatenated datastore indexing those same columns and using sections within new applications. Will my older applications still be able to access the individual intermedia text indexes that are already in place or will I have to modify the older applications to access the new concatenated datastore?

  • Text query using a Multi Column datastore index slow

    I have created a text index using multi column datastore preference. I have specified two clob columns in my preference. Searching on this new index works, but it is slower than I expected.
    I have done the following comparison:
    My original two clob columns are: DocumentBody and DocumentFields. I have built an individual text index on each column. My new column with Multi Column index is DocumentBodyAndFields;
    I did two queries:
    1. search 'dog' on DocumentBody UNION search 'dog' on DocumentFields;
    2. search 'dog' on DocumentBodyAndFields;
    I would think the second search should be faster than the first one because it is a single query. But this is not the case. The second query is consistently slower than the first query by about 10-20%.
    Things are getting much worse when I search on preceding wildcards. If I search '%job', the multi column index is twice as slow as the first query! I am very confused by this result. Is this a bug?

    I am unable to reproduce the performance problem. In my tests, the search that uses the multicolumn_datastore performs better, as demonstrated below. Can you provide a similar test case that shows the table structure, datastore, index creations, and explain plan?
    SCOTT@orcl_11g> CREATE TABLE your_tab
      2    (DocumentId            NUMBER,
      3       DocumentBody            CLOB,
      4       DocumentFields            CLOB,
      5       DocumentBodyAndFields  VARCHAR2 (1))
      6  /
    Table created.
    SCOTT@orcl_11g> INSERT ALL
      2  INTO your_tab VALUES (-1, 'adog', 'bdog', NULL)
      3  INTO your_tab VALUES (-2, 'adog', 'whatever', NULL)
      4  INTO your_tab VALUES (-3, 'whatever', 'bdog', NULL)
      5  SELECT * FROM DUAL
      6  /
    3 rows created.
    SCOTT@orcl_11g> INSERT INTO your_tab
      2  SELECT object_id, object_name, object_name, NULL
      3  FROM   all_objects
      4  /
    69063 rows created.
    SCOTT@orcl_11g> BEGIN
      2    CTX_DDL.CREATE_PREFERENCE
      3        ('your_datastore', 'MULTI_COLUMN_DATASTORE');
      4    CTX_DDL.SET_ATTRIBUTE
      5        ('your_datastore', 'COLUMNS', 'DocumentBody, DocumentFields');
      6  END;
      7  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> CREATE INDEX your_idx1 ON your_tab (DocumentBody)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  /
    Index created.
    SCOTT@orcl_11g> CREATE INDEX your_idx2 ON your_tab (DocumentFields)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  /
    Index created.
    SCOTT@orcl_11g> CREATE INDEX your_idx3 ON your_tab (DocumentBodyAndFields)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  PARAMETERS ('DATASTORE your_datastore')
      4  /
    Index created.
    SCOTT@orcl_11g> EXEC DBMS_STATS.GATHER_TABLE_STATS (USER, 'YOUR_TAB')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> SET TIMING ON
    SCOTT@orcl_11g> SET AUTOTRACE ON EXPLAIN
    SCOTT@orcl_11g> SELECT DocumentId FROM your_tab
      2  WHERE  CONTAINS (DocumentBody, '%dog') > 0
      3  UNION
      4  SELECT DocumentId FROM your_tab
      5  WHERE  CONTAINS (DocumentFields, '%dog') > 0
      6  /
    DOCUMENTID
            -3
            -2
            -1
    Elapsed: 00:00:00.65
    Execution Plan
    Plan hash value: 4118340734
    | Id  | Operation                     | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT              |           |     4 |   576 |     2 (100)| 00:00:01 |
    |   1 |  SORT UNIQUE                  |           |     4 |   576 |     2 (100)| 00:00:01 |
    |   2 |   UNION-ALL                   |           |       |       |            |          |
    |   3 |    TABLE ACCESS BY INDEX ROWID| YOUR_TAB  |     2 |   288 |     0   (0)| 00:00:01 |
    |*  4 |     DOMAIN INDEX              | YOUR_IDX1 |       |       |     0   (0)| 00:00:01 |
    |   5 |    TABLE ACCESS BY INDEX ROWID| YOUR_TAB  |     2 |   288 |     0   (0)| 00:00:01 |
    |*  6 |     DOMAIN INDEX              | YOUR_IDX2 |       |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       4 - access("CTXSYS"."CONTAINS"("DOCUMENTBODY",'%dog')>0)
       6 - access("CTXSYS"."CONTAINS"("DOCUMENTFIELDS",'%dog')>0)
    SCOTT@orcl_11g> SELECT DocumentId FROM your_tab
      2  WHERE  CONTAINS (DocumentBodyAndFields, '%dog') > 0
      3  /
    DOCUMENTID
            -1
            -2
            -3
    Elapsed: 00:00:00.28
    Execution Plan
    Plan hash value: 65113709
    | Id  | Operation                   | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |           |     4 |    76 |     0   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| YOUR_TAB  |     4 |    76 |     0   (0)| 00:00:01 |
    |*  2 |   DOMAIN INDEX              | YOUR_IDX3 |       |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("CTXSYS"."CONTAINS"("DOCUMENTBODYANDFIELDS",'%dog')>0)
    SCOTT@orcl_11g>

  • Fuzzy searching and concatenated datastore query performance problems.

    I am using the concatenated datastore and indexing two columns.
    The query I am executing includes an exact match on one column and a fuzzy match on the second column.
    When I execute the query, performance should improve as the exact match column is set to return less values.
    This is the case when we execute an exact match search on both columns.
    However, when one column is an exact match and the second column is a fuzzy match this is not true.
    Is this normal processing??? and why??? Is this a bug??
    If you need more information please let me know.
    We are under a deadline and this is our final road block.
    TIA
    Colleen GEislinger

    I see that you have posted the message in the Oracle text forum, good! You should get a better, more timely answer there.
    Larry

  • Concatenated datastore performance with other predicates

    Hi
    I am using context indexes with a concatenated datastore.
    The query is like this -
    select *
    from my_table
    where contains ( my_column, 'token_1 within xx or token_2 within yy ', 1 ) > 0
    and some_other_column = 'xxx'
    There is no index on "some_other_column".
    Would it help to include "some_other_column" in the concatenated datastore? Will this increase the performance of the query, or does it always depends on the type of data we have?
    How is the query of a concatenated datastore fired? Is the $I table queried for each token in the query?
    Thanks and regards
    Pratap

    Yes, it should generally be faster to include "some_other_column" in the
    list for the concatenated datastore.
    The query would then be
    select * from my_table where contains
    ( my_column, '(token_1 within xx or token_2 within yy) and (xxx within some_other_column)', 1 ) > 0
    Note that this is not exactly the same as your query - for example if some_other_column contained "abc xxx xyz" then my query would be a hit but yours would not. If you know the column will only ever contain one word, then they are identical.
    - Roger

  • Concatenated datastore fuzzy searches and performance...

    Oracle 8.1.7:
    I am using the concatenated datastore and indexing two columns.
    The query I am executing includes an exact match on one column and a fuzzy match on the second column.
    When I execute the query, performance should improve as the exact match column is set to return less values.
    This is the case when we execute an exact match search on both columns.
    However, when one column is an exact match and the second column is a fuzzy match this is not true.
    Is this normal processing??? and why??? Is this a bug??
    If you need more information please let me know.
    We are under a deadline and this is our final road block.
    TIA
    Colleen GEislinger

    This is more information about our scenario:
    We have two groups in the datastore:
    concat:
    1.) hierarchy:(example text) 321826 325123 543123
    2.) page: Actual document text.
    321826 325123 543123 represents ids in a hierarchy structure. As you move from left to right the number of times the number occurs is less so there should be less exact matches.
    Example: In this index all pages have 321826 as the first value. A few pages have 543123 and all others will have some other number as the last value.
    if I do this query:
    contains(concat,(321826 within hierarchy ) and ('personnel') within page)
    it takes about 10 seconds because it 321826 will hit all pages.
    if I do this query:
    contains(concat,(543123 within hierarchy ) and ('personnel') within page)
    it takes only about 1 second because it 543123 will hit just a few pages.
    BUT:::::::
    Fuzzy search....
    if I do this query:
    search A.) contains(concat,(321826 within hierarchy ) and ?('personnel') within page)
    it takes about 30 seconds because it 321826 will hit all pages. This is okay for performance for this.
    BUT if I do this query:
    search B.) contains(concat,(543123 within hierarchy ) and ?('personnel') within page)
    it takes about 30 seconds even though 543123 will hit only a few pages.
    This should be faster than 30 seconds because you're searching over only a fraction of material for the fuzzy search part.
    We've played with different variations on the () and the '' but nothing seems to change this.
    Any advice on how to make search B.) faster??
    We don't understand why see the different speeds in the exact match and we DON'T see the different speeds in the fuzzy search...
    I can send you some test data with the index and query scripts if you want.
    Our indexes are on large tables (2,000,000) rows.
    TIA
    Colleen Geislinger.

  • Concatenated Datastore doesn't work for me

    I'm using oracle InterMedia Text.
    Now I'm trying to build a Concatenated Datastore.
    I executed the sql-file cdstore.sql. 0 Errors.
    But when I'm trying to execute
    "exec ctx_cd.add_column('my_cdstore',columnname)
    I get this error:
    ORA-01749: you may not GRANT/REVOKE privileges to/from yourself
    ORA-06512: at "TWEB.CTX_cd", line 315
    ORA-06512: at "TWEB.CTX_cd", line 443
    ORA-06512: at "TWEB.CTX_cd", line 816
    ORA-06512: at line 2
    I'm fairly confused. I read that "The Concatenated Datastore is an additional datastore for Oracle Text".
    Can I use it when I'm working with Intermedia, or what am I doing wrong???
    THX for help!

    There are two possibilities here. I think the most likely one is that you've accidently run cdstore.sql as the user "tweb" at some stage. The ctx_cd package is therefore over-riding the version owned by user CTXSYS.
    To check this, log on as user tweb, and do this:
    DROP PACKAGE CTX_CD;
    if that succeeds - then this is the problem. You'll also want to do all this as tweb:
    DROP PACKAGE FRIEDMAN;
    DROP TABLE CTX_CDSTORES;
    DROP TABLE CTX_CDSTORE_COLS;
    DROP SEQUENCE CTX_CDSTORE_SEQ;
    DROP VIEW CTX_USER_CDSTORES;
    DROP VIEW CTX_USER_CDSTORE_COLS;
    The other possibility is that you've modified the package so that it runs under "invoker rights" rather than "definer rights", using the AUTHID clause. This will not work.
    Please let me know if this solves your problem.
    - Roger

  • Problem with Concatened Datastore

    Hello,
    We try to implement the "Concatened Datastore". And we've got errors.
    So we download the zip file from the link "Download the kit" on the page http://www.oracle.com/technology/sample_code/products/text/htdocs/concatenated_text_datastore/cdstore_readme.html#Installation. We unzip the file and got several files.
    1) We try the "full_example" file, but the script "cdstore_10g_user" (line 12) don't exist ; sick.
    2) So, to workaround, we try to follow the instructions in the "full_example.sql" file, with little corrections :-)). We create a user test_user, we load the cdstore.sql file, and here, we'got some errors. One for table they don't exist (ORA-00942 ; the first time it's normal. New tables don't exist), and one other for an invalid identifier (ORA-00904). Here the exact log :
    Warning: Package Body created with compilation errors.
    Errors for PACKAGE BODY CTX_CD:
    LINE/COL ERROR
    48/7 PL/SQL: SQL Statement ignored
    51/16 PL/SQL: ORA-00904: "CDSTORE_NAME": invalid identifier
    3) We continue the "full_example.sql" file. Create a table mytab for the test_user, insert data into this table, drop data into cdstore. And when we try to create a new cdstore, we've got this error :
    SQL> prompt new...
    begin
    ctx_cd.create_cdstore('my2_cdstore', 'mytab');
    end;
    new...
    SQL> 2 3 4 begin
    ERROR at line 1:
    ORA-04063: package body "TEST_USER.CTX_CD" has errors
    ORA-06508: PL/SQL: could not find program unit being called: "TEST_USER.CTX_CD"
    ORA-06512: at line 2
    Is there anyone, who can tell us what's wrong ?
    Best regards
    Laurent PELLETIER

    ATTENTION ROGER FORD
    It looks like you need to make a few fixes to your full_example.sql and cdstore.sql. It looks like there are some mismatches between names of scripts and what is called and between names of tables created and selected from and so forth and some missing values for inserts. When I initially ran it with the cdstore.sql under the scott schema it ran o.k. because it was using the old definitions from the previous version, but then it wouldn't run under the test_user, so I suspect it was using the old definitions when you tested as well. After making the following corrections, it ran successfully with the test_user.
    -- changes to full_example.sql:
    --   changed password for system (not a bug)
    --   changed @cdstore_10g_user to @cdstore
    -- changes to cdstore.sql:
    --   first: 
    --     changed each occurrence of ctx_cdstore to ctx_user_cdstore
    --   then:
    --     added column cdstore_name varchar2(30) to ctx_user_cdstore_cols table:
    --       create table ctx_user_cdstore_cols (... cdstore_name varchar2(30) ...) 
    --     added cdstore_name and l_name to both inserts into ctx_user_cdstore_cols:
    --       insert into ctx_user_cdstore_cols (... cdstore_name ...)
    --       values (... l_name ...)

  • Can Oracle be forced to use the spatial index for sdo_filter in combination with an or clause? Difference between Enterprise and SE?

    We’re seeing the following issue: sql - Can Oracle be forced to use the spatial index for sdo_filter in combination with an or clause? - Stack Overflow (posted by a colleague of mine) and are curious to know if this behaviour is due to a difference between standard and enterprise, or could we doing something else wrong in our DB config.?
    We have also reproduced the issue on the following stacks:
    Oracle SE One 11.2.0.3 (with Spatial enabled)
    Redhat Linux 2.6.32-358.6.2.el6.x86_64 #1 SMP Thu May 16 20:59:36 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
    11.2.0.3.0 Standard Edition and 11.2.0.4.0 Standard Edition (both with Spatial enabled)
    Microsoft Windows Server 2003R2 Standard x64 Edition
    However, the SQL works fine if we try it on Oracle 11.2.0.3.0 *Enterprise* Edition.
    Any help or advice would be much appreciated.
    Kindest Regards,
    Kevin

    In my experience sdo_filter ALWAYS uses the spatial index, so that's not the problem. Since you did not provide the explain plans, we can't say for sure but I think yhu is right: Standard Edition can't use the bitmap operations, and thus it'll take longer to combine the results of the two queries (because the optimizer will surely split this OR up in two parts, then combine them).
    BTW: when asking questions about queries here, it would be nice if you posted the queries here as well, so that we do not have to check another website in order to see what you are doing. Plus it will probably get you more answers, because not everyone can be bothered to click on that link. It would also have been nice if you had posted your own answer on the other post here as well, because my recommendation would have been to use union all - but since you already found that out for yourself my recommendation would have been a little late.

  • Query don't use the right index when using bind variables

    Hi people !
    I need some help because I have an issue with a query that don t use the right Indexes as it should
    First of all, I have mainly three tables :
    ORDER : Table that contains description for each Order (approximately 1 000 000 Records)
    ORDER_MVTS : Table that contains the tasks made (called movements) to set up each Orders
    with quantity of packages prepared for each product (approximately 10 000 000 Records)
    PRODUCT : Tables that contains the products (approximately 50 000 Records)
    When I launch the query with hard coded values, it brings back response very fast
    because it uses the right index (ORDER_DHR_VALID) which represent the date and hour of the order
    (with format 'DD/MM/YYYY HH24:MI:SS'). The selectivity for this index is good.
    NB 1: I have to use the trick " >= Trunc(date) and < trunc(date) +1 " to filter on a simple date because
    the index contains hour and minutes (I know it wasn't probably a bright idea at conception time).
    NB 2: The index on ORDER_MVTS.PRODUCT_CODE is'nt discriminating enough because there is'nt enough different products.
    It's the same for index on CUSTOMER_CODE and on MVT_TYPE so only the index on ORDER.DHR_VALID is good.
    Here is the correct explain plan when I execute the query with hard coded values :
    SELECT SUM(ORDER_MVTS.NB_PACKAGE)
    FROM ORDER_MVTS, PRODUCT, ORDER
    WHERE ORDER.DHR_VALID >= TRUNC(to_date('14/11/2008 10:04:56','DD/MM/YYYY HH24:MI:SS'))
    AND ORDER.DHR_VALID < TRUNC(to_date('14/11/2008 10:04:56','DD/MM/YYYY HH24:MI:SS')) + 1
    AND ORDER_MVTS.MVT_TYPE = 'DELIVERY'
    AND PRODUCT.CODE = ORDER_MVTS.PRODUCT_CODE
    AND ORDER_MVTS.ORDER_CODE = ORDER.CODE
    AND ORDER.CUSTOMER_CODE = 'ADIDAS'
    AND PRODUCT.CODE = 1234
    Rows Row Source Operation
    1 SORT AGGREGATE
    2 NESTED LOOPS
    4 NESTED LOOPS
    2 INDEX UNIQUE SCAN (object id 378548) --> PRODUCT_PK
    4 TABLE ACCESS BY INDEX ROWID ORDER
    777 INDEX RANGE SCAN (object id 378119) --> ORDER_DHR_VALID
    2 TABLE ACCESS BY INDEX ROWID ORDER_MVTS
    30 INDEX RANGE SCAN (object id 377784) --> ORDER_MVTS_ORDER_FK
    Now the problem is when the query is used in a Cursor with bind variables.
    It seems like Oracle don't use index on ORDER.DHR_VALID because he can't figure out that he have
    to actually filter on a short period of time (only one day).
    So Oracle uses the index on ORDER_MVTS.PRODUCT_CODE which is'nt a bright idea (it takes 10 secondes instead of just one)
    Here is the bad explain plan :
    Rows Row Source Operation
    1 SORT AGGREGATE
    2 NESTED LOOPS
    722 NESTED LOOPS
    2 INDEX UNIQUE SCAN (object id 378548) --> PRODUCT_PK
    722 TABLE ACCESS BY INDEX ROWID ORDER_MVTS
    1790 INDEX RANGE SCAN (object id 377777) --> ORDER_MVTS_PRODUCT_FK
    2 TABLE ACCESS BY INDEX ROWID ORDER
    1442 INDEX UNIQUE SCAN (object id 378439) --> ORDER_PK
    Now I have found two solutions to this problem :
    1) using a Hint to force the use of index on ORDER.DHR_VALID (with /*+ INDEX(ORDER ORDER_DHR_VALID) */ )
    2) Using Dynamic SQL and keeping the date hard coded (but not the other values except mvt_type)
    For example :
    QUERY :=
    'SELECT SUM(ORDER_MVTS.NB_PACKAGE)
    FROM ORDER_MVTS, PRODUCT, ORDER
    WHERE ORDER.DHR_VALID >= TRUNC(TO_DATE('''||To_char(P_DTE_VAL,'DD/MM/YYYY')||''',''DD/MM/YYYY'')) '||
    AND ORDER.DHR_VALID < TRUNC(TO_DATE('''||To_char(P_DTE_VAL,'DD/MM/YYYY')||''',''DD/MM/YYYY'')) + 1 '||
    AND ORDER_MVTS.MVT_TYPE = 'DELIVERY'
    AND PRODUCT.CODE = ORDER_MVTS.PRODUCT_CODE
    AND ORDER_MVTS.ORDER_CODE = ORDER.CODE
    AND ORDER.CUSTOMER_CODE = :CUSTOMER
    AND PRODUCT.CODE = :CODE ';
    These two solutions work but Number 1 is bad in theory because it uses a Hint
    and Number 2 may be difficult to code.
    So my question is : Does someone knows another solution to force the use of index ORDER_DHR_VALID that can be simple and reliable.
    Thank you very much for support
    Edited by: remaï on Apr 1, 2009 4:08 PM

    What version of oracle you have? CBO work is different in 9i and 10g.
    Usually cost based optimizer do not want to use index for >< condition with binding variables because optimizer can not use statistic to determine selectivity, and by default selectivity of <> operators is low.
    (As I remember '>' selectivity by default is 5%, you have two conditions > and <, therefore resulting selectivity will be 0.05*0.05=0.0025 as two independent events, but selectivity of other conditions
    ORDER_MVTS.MVT_TYPE = 'DELIVERY' or ORDER.CUSTOMER_CODE = 'ADIDAS' looks much better for CBO)
    The best solution I see is do not use binding variables. Actually your query looks as searching query, which executes not so often, therefore you will not have perfomance win along of skipping execution plan creation.
    Edited by: JustasVred on Apr 1, 2009 10:10 AM

  • Unable to download OS X using Zapping PRAM index.

    Unable to download OS X using Zapping PRAM index. Gives OS X Mavericks failed to download use the purchases page to try again - But cant see Mac app store icon as screen has completely gone grey
    Since yesterday my Macbook Pro is not working - rather I cant see finder and upon booting, instead of any screen savers and icons displaying it is showing a balnk grey screen.
    After reading some discussion and watching to some videos on You Tube, I managed to empty my Mac HD by traferring all the files to an external HD and then suing zapping PRAM keys, I got to a screen from where I am trying to download OS X to re install it.
    However after some time it is giving error as 'OS X Mavericks failed to download use the purchases page to try again'.
    But to access purchase page, I am unable to view Mac app stores application or icon.
    Please help in fixing this issue.

    Hi there,
    Mine is 2011.
    I tried the suggestion you gave, but it didnt work.
    However can someone help with clarification - mine is 2011 MBP and I reconk that it came with OS X Lion pre-installed and now with OS X utilities page, when I try to reinstall OSX it tries installing Mavericks and fails at certain stage.
    When it fails I  get pop-up message as 'OS X Mavericks failed to download use the purchases page to try again'
    But I am unable to get App stores and go to purchases, as I dont see that option anywhere using OS X Utilities (which is the only way I am able to access my mac once I start)
    So, Kindly help whether I need to get OS X Lion reinsalled first and then upgrade OS X Mavericks?
    To do so, should I buy OS X Lion (as I dont think there is any back-up of OS available on my machine)?
    Any suggestion will be much appreciated.

  • Force use of an INDEX in ABAP

    Is there a way to force the use of an index for a select statement in ABAP?
    Is it possible ? Maybe with EXEC SQL . . .
    Here find a trace
    SELECT STATEMENT ( Estimated Costs = 28.747 , Estimated #Rows = 9 )   
        5  2 TABLE ACCESS BY INDEX ROWID EDIDC
       ( Estim. Costs = 28.747 , Estim. #Rows = 9 )         
               1 INDEX RANGE scan EDIDC~3    
        ( Estim. Costs = 1.207 , Estim. #Rows = 269.667 )
    As we can see sql optimizer choose index 3 but I though index 1 is better....
    regards,

    Hi Guys,
    With reference to Indexes, the best way to use them is to check out all the fields that are available in the index and make your Select Query in such a way that :
    (1) The fields in the index are present in your query.
    (2) The fields are in the same order in the index and the query.
    (3) OR conditions are avoided in the same line. E.g. Where ( matnr = '10000034' OR maktx = 'BB Prod.')
    - Such statements are to be avoided.
    If in a table there are many indexes SAP will decide by itself which index to use. This decision is based on a sampling percentage. This data is filled based on your configuration and can be viewed in ST05. In case the data has not been updated, you may find that SAP will use an index which you might not find suitable. Hence a situation may come up when you are required to force an index to be used in your SELECT query.

  • OSB11g - using Concatenation function in report key - Xpath

    Hi,
    I am trying to use Concatenation function on Report key Xpath. For that i am using Following Xpath Expressions But this expressions not valid when trying to validate. But same expressions are valid under different scenarios in OSB.
    1.fn:concat(./bpel:process/bpel:input, ./bpel:process/bpel:input)
    error msg(when validate):_
    error: XPath expression invalid, not a selection: declare namespace jca = 'http://www.bea.
    com/wli/sb/transports/jca'; declare namespace wsp = 'http://schemas.xmlsoap.org/ws/2004/09/policy';
    declare namespace jms = 'http://www.bea.com/wli/sb/transports/jms'; declare namespace tp = 'http:
    //www.bea.com/wli/sb/transports'; declare namespace wsa05 = 'http://www.w3.
    org/2005/08/addressing'; declare namespace jejb = 'http://www.bea.com/wli/sb/transports/jejb';
    declare namespace xs = 'http://www.w3.org/2001/XMLSchema'; declare namespace sftp = 'http://www.
    bea.com/wli/sb/transports/sftp'; declare namespace flow = 'http://www.bea.com/alsb/flow/transport';
    declare namespace soap-env = 'http://schemas.xmlsoap.org/soap/envelope/'; declare namespace wsu
    = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'; declare
    namespace dsp = 'http://www.bea.com/dsp/transport/sb'; declare namespace ejb = 'http://www.bea.
    com/wli/sb/transports/ejb'; declare namespace bpel = 'http://xmlns.oracle.
    com/Bpel_Actvities/Assign_Activity/BPELProcess'; declare namespace wsa = 'http://schemas.xmlsoap.
    org/ws/2004/08/addressing'; declare namespace bpel-10g = 'http://www.bea.
    com/wli/sb/transports/bpel10g'; declare namespace tuxedo = 'http://www.bea.
    com/wli/sb/transports/tuxedo'; declare namespace file = 'http://www.bea.com/wli/sb/transports/file';
    declare namespace ctx = 'http://www.bea.com/wli/sb/context'; declare namespace fn = 'http://www.w3.
    org/2004/07/xpath-functions'; declare namespace soap12-enc = 'http://www.w3.org/2003/05/soap-
    encoding'; declare namespace soap12-env = 'http://www.w3.org/2003/05/soap-envelope'; declare
    namespace fn-bea = 'http://www.bea.com/xquery/xquery-functions'; declare namespace mq = 'http:
    //www.bea.com/wli/sb/transports/mq'; declare namespace ws = 'http://www.bea.
    com/wli/sb/transports/ws'; declare namespace http = 'http://www.bea.com/wli/sb/transports/http';
    declare namespace soa-direct = 'http://www.bea.com/wli/sb/transports/soa'; declare namespace email
    = 'http://www.bea.com/wli/sb/transports/email'; declare namespace sb = 'http://www.bea.
    com/wli/sb/transports/sb'; declare namespace ftp = 'http://www.bea.com/wli/sb/transports/ftp';
    declare namespace xsd = 'http://www.w3.org/2001/XMLSchema'; declare namespace soap-enc = 'http:
    //schemas.xmlsoap.org/soap/encoding/'; declare namespace xsi = 'http://www.w3.
    org/2001/XMLSchema-instance'; fn:concat(./bpel:process/bpel:input, ./bpel:process/bpel:input)
    2. op:concatenate(./bpel:process/bpel:input, ./bpel:process/bpel:input)
    While using this Xpath expression validation is sucessfull but concatenation operation is not working when checked in the message reports under operations tab.
    Can any one help me on this.
    Thanks in advance.

    can you try assign concatenated value to some xml element first, like
    assign : <value>{fn:concat(a,b)}</value> to e.g. value
    and then report key ./text() in variable $value
    Edited by: AigarsP on Jun 12, 2012 4:12 AM

  • Why does Acrobat XI fail to automatically use a PDX index?

    I've just upgraded from Acrobat 7 Pro to Acrobat XI Pro. In Acrobat 7, if a PDX index file was specified in the (File->Properties->Advanced->Search Index) window of an initial PDF, that index file would be available to other PDFs that were opened by clicking on links in the initial PDF. This was true even if an indexed search was NOT initiated when the initial PDF was being viewed.
    In Acrobat XI Pro this is not the case. The only way to make the PDX index file, specified in the initial PDF, available to subsequent PDFs is to actually initiate an indexed search while the initial PDF is being viewed. If this is not done, once a user has moved off of the initial PDF, the ability to search using the PDX index in no longer available while they are browsing the hundreds of PDFs that are "children" of the initial PDF. The only way for the user to "activate" the PDX index is to go back to the initial PDF and then do an indexed search. Once that is done, Acrobat will use the PDX file for all other index searched, no matter what PDF file the user is viewing.
    As was the case in Acrobat 7, is there a way to cause Acrobat XI Pro to "activate" the specifed PDX index file without the extra step of:
    - doing an unneeded indexed search after opening the initial PDF containing the PDX setup
           or
    - going to (Edit->Advanced Search->Show More Options->Look In: Select Index...)  and picking the needed PDX index file
    In other words, under Acrobat 7, as long as the PDX index is specified in the initial PDF, the user does not need to do anything to have the PDX index available no matter what PDF they are viewing.  Any ideas on how to get Acrobat XI Pro to this?

    You can try changing the scanner's Native options.
    In Acrobat, choose File > Create > PDF from Scanner > Custom Scan. 
    1. Click the Options button to the right of the scanner name.
    2. In the Scanner Options dialog, choose Show Scanner's Native Interface from the pop-up menu.
    3. In the scanner's interface, choose the correct input method.
    Thanks
    Varinder

  • TREX on Portal-Server also used for search/index for SAP Records Management

    Hi all,
    can a installation of the TREX on the Portal-Server (or as separate Server) used for Portal Index/search and also in parallel for searching of Content in an SAP Records Management (means full text research of records/ dossier in the SAP RM) ? Some ideas, tips or settings to keep in mind ?
    THX
    mario

    Hi Neil,
    We have exactly the same problem. We installed a new SAP E-Commerce system on Microsoft Windws 2008 R2 with TREX Version 7.10.43.00. The TREX connection is okay. Also the catalogue replication works without any problems. The SAP support means it is a permission problem on the IIS. The problem isnu2019t solved yet and the message to the SAP support is in process.
    What is your effect with this link?
    http://localhost:<TREXNAMESERVER>/TREXHttpServer/
    Default:
    http://localhost:<30305>/TREXHttpServer/
    Kind regards,
    Roland

Maybe you are looking for

  • Oracle SQL Query from EXCEL 2007 with prompt

    Hello, I have many excel reports where I am pulling information from our Oracle 9 db through Excel using the following method: http://blog.mclaughlinsoftware.com/microsoft-excel/how-to-query-oracle-from-excel-2007/ http://blog.mclaughlinsoftware.com/

  • RTF Template formatting problem

    Hi, I am designing a report layout using MS Word. The report format is like this Employee: EmpID                           Date of Joining: DOJ Employee Name: Ename                      Department     : DeptThe problem is that when i generate pdf pre

  • Lost most of the library in I Tunes

    I lost 12000 songs from the library on I tunes as well as all the playlists. What can I do to get that back? I still have the music files, but the songs in there are not in the library. I can put them one one by one, but that takes years. I have one

  • Procurement

    Hi               A material  is procured with out excise duty for EOU ( Export oriented unit) but that material is rejected due to some quality failed and now it should be sent to vendor again with out excise duty but in MM point of view the excise d

  • I'm not familiar with MAC's.  Trying to insert turbo tax cd into my Dad's Mac OS X version 10.5.8 but it won't go in/stay.  Help please!

    I am not familiar with MAC's.  I am trying to insert Turbo Tax CD into my Dad's Mac.  But, the CD will not go in/stay in.  Need some help with this, anyone have an answer?  I would greatly appreciate it!  Thanks!