[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

query optimizer problem when using InterMedia Text Index

Asked by bddoki in Oracle Database

Tags: oracle, contains, intermedia, text

Hello,

I have problem with the cost base query optimizer (oracle 8.1.7) in case of
InterMedia Text indexes.

I have a table with a clob column indexed with InterMedia Text as:

     create index IND_DOC_DOCUMENT_BUFFER On DOCUMENTS(DOCUMENT_BUFFER)
          INDEXTYPE IS CTXSYS.CONTEXT
          PARAMETERS(''FILTER CTXSYS.NULL_FILTER SECTION GROUP CTXSYS.AUTO_SECTION_GROUP');

There are 60000 xml documents in the table, and all the documents contains the word 'test' within the 'type' tag.

When I execute the following query:

     select * from (
          select /* FIRST_ROWS */ id from documents where contains(document_buffer,'test')>0 order by id desc
          )
     where rownum<=20;

the query optimizer produces the following execution plan:

     Query Plan
     ----------
     SELECT STATEMENT   Cost = 826
              COUNT STOPKEY  
                  VIEW  
                           TABLE ACCESS BY INDEX ROWID DOCUMENTS
                               INDEX FULL SCAN DESCENDING PK_DOC_ID

In this case the query optimizer detects, that the contains expression is not
selective, so the query plan does not use the text index. The query quickly returns
the first 20 rows.

In contrary, when I use the contains(document_buffer,'test within type')>0 expression,
the query optimizer choses an other query plan:

     Query Plan
     ----------
     SELECT STATEMENT   Cost = 58
              COUNT STOPKEY  
                  VIEW  
                           SORT ORDER BY STOPKEY  
                               TABLE ACCESS BY INDEX ROWID DOCUMENTS
                                        DOMAIN INDEX  IND_DOC_DOCUMENT_BUFFER

In this case the query optimizer is not able to estimate the selectivity of the contains
expression properly, so the query plan use the text index to retrive the selected rows.
The result set (all the 60000 rows) must be sorted before the first 20 record is retrived
and it takes 80 seconds executing the query.


The expressions "contains(document_buffer,'test')>0" and
"contains(document_buffer,'test within type')>0" yields different selectivity
for the query optimizer, Though all the documents contains the word 'test'
within the 'type' tag, and so the two expression should have the same selectivity.


Is there someone who knows how to make the query optimizer to build the proper query paln
in the second case as well? Recently I have to run a query to decide the selectivity of
the expression and use "contains(...) || null >0" expression to avoid using the text index
when the expression is not selective.


[+][-]05/26/02 08:33 PM, ID: 7036381Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Oracle Database
Tags: oracle, contains, intermedia, text
Sign Up Now!
Solution Provided By: Mindphaser
Participating Experts: 2
Solution Grade: A
 
[+][-]05/14/01 06:42 AM, ID: 6077650Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/14/01 07:19 AM, ID: 6077817Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/14/01 07:50 AM, ID: 6077961Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/24/02 08:30 PM, ID: 7033925Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93