Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Nilesh.

Asked: April 13, 2018 - 11:43 am UTC

Last updated: August 21, 2018 - 12:39 pm UTC

Version: 11.2g

Viewed 1000+ times

You Asked

Hi Tom

I am not an expert in oracle so thought I will use your help here. I have an application which does a full text search but it is very very slow. Not sure if I build the index correctly. Below are the details:

BELOW IS USED TO CREATE INDEX:

CREATE INDEX "KMCS"."ARTIFACTS_TEXT_INDEX" ON "KMCS"."ARTIFACT_FILES" ("ORIGINAL_PATH")
INDEXTYPE IS "CTXSYS"."CONTEXT" PARAMETERS ('DATASTORE ctxsys.file_datastore
FILTER artifacts_filter
LEXER ARTIFACT_TEXT_INDEX_LEX
STOPLIST KM_STOPLIST
WORDLIST ARTIFACT_TEXT_INDEX_WDL
STORAGE ARTIFACTS_TEXT_INDEX_STO
MEMORY 250M')
PARALLEL 4 ;

ARTIFACT_FILES TABLE CONTAINS 4M ROWS. RUNNING A FULL TEXT SEARCH TAKES A LONG TIME TO RETURN RESULT. BELOW IS THE CAPTURE FROM OEM OF THE QUERY EXECUTED:

select *
from (
select /*+ FIRST_ROWS(1000) */ a.*, rownum rnum
from (
select aem.artifact_id id
from artifact_email_metadata aem , kmcs_objects ko , artifacts art , container_artifacts ca , context_folders cf , artifact_files af
where ko.deleted = '0' and ko.id = art.artifact_id and art.artifact_id = aem.artifact_id and art.enabled = '1' and art.artifact_id = ca.artifact_id and ca.container_id = cf.container_id and ca.is_in_recycle_bin = '0' AND aem.artifact_id = af.artifact_id and CONTAINS(af.original_path, :p_1)>0 order by aem.email_date desc ) a
where rownum <= :sizelimit )
where rnum >= 0

I HAVE THE QUERY PLAN FROM OEM BUT CANNOT PASTE HERE AS IT IS NOT ALIGNED.

PLEASE HELP ON THIS MATTER.

THANK YOU AND MUCH APPRECIATED.

and Connor said...

Take a look at this link

https://asktom.oracle.com/pls/apex/asktom.search?tag=oracle-text-with-order-by-clause

which talks about Text indexes that *also* have awareness of the sorting clause. This is a common technique when dealing with first rows style operations to avoid a large sorting process if the text index returns a lot of rows.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Thank you

Nilesh Choudhary, April 16, 2018 - 9:38 am UTC

Hi

Thank you for getting back and suggesting the solution. I will give it a go.

Thank you
N

Nilesh Choudhary, August 21, 2018 - 12:06 pm UTC

Thanks for helping, you were a great help.
Connor McDonald
August 21, 2018 - 12:39 pm UTC

glad we could help

More to Explore

Design

New to good database design? Check out Chris Saxon's full fundamentals class.