Slow search on Indexed XMLTYPE Column

Posted on 2004-08-21
Last Modified: 2008-02-01
HI friends,

I have one table with one column defined as XMLType and 4 other column as number types.

field1 number(1),field2 number(1),field3 number(1),field4 number(1),field5 xmltype

The table is partitioned by range on field1 column. (10 partitions ranging 0-9)
There is primary key on field2 column. A unique index is created on (field1,field3) columns
XMLType column ie field5 is indexed using Oracle Text Manager CONTEXT with PATH_SECTION_GROUP as an additional preference. The DEFAULT_MEMORY_SIZE Changed to 49 MB using Ctx_Adm.SetParameter.

For 100 to 1000 records, its very fast for queries using the contains operator. ie say about .05 seconds or near to that. But after loading about 100,000 records, then its damn slow, say about 30-45 seconds.

I am using the query

Even after executing the Optimize Fast function also does not makes any performance gain. My Oracle version is The search engine is developed on Java.

Please guide me to how to build performance in this. I am ready to start the process from the scratch.

Question by:jimaricat072100
  • 3
  • 2

Expert Comment

ID: 11858768
You need a functional index on the xmltype column.

Here is an example I found.



Author Comment

ID: 11862470
thanks morphman for the response,

so you mean to drop all other indexes and put only functional index will improve the performance. Or should i add this functional index to the current setup.
And one more doubt. Since my xml documents having diferrent root element, how can your indexing strategy can be modified. Should i put similar functional indexes on each of the elements.


Accepted Solution

morphman earned 250 total points
ID: 11863431
You will only need to drop other indexes containing the xmltype column. (if that is all indexes, so be it).

I am not sure whether you can create multiple functional indexes on the same column. If you use several elements, I would certainly try to index each element you wish to query with a separate functional index, but im not sure Oracle will alow it.

You would have to try it.

If you really need more performance out of querying your XML documents, it may be better to store them in a different manner than using XMLType objects.

eg. You could parse all of your xml documents when loading them into a database, and place the elements you wish to query into a separate lookup table which will point directly to the XML document. These standard text columns will then get indexed normally and give the performance you require.

Take a look at

Which discusses the benefits of each type of XML storage.

Author Comment

ID: 11945293
Sorry for the delay.

I did as morphan said, but the performance was same and moreover the maintenance of each functional indexes is bit complicated.

Thankyou for the alternate solution provided. I am trying to store the XMLDocuments using File Store. It seems the performance is much better with less records. But not much as i expected. Anyhow i am trying my level best. From the asktom site, i found out another issue. If the xmldocuments are not stored against a defined schema, then the search will not use the context domain index. I have approached metalink and submitted a TAR. I am waiting for the response.

Anyway morphan i'll surely give points, but i appreciate if this discussion can go further in deeper.

Author Comment

ID: 12145180
Actually i was waiting for few more tips regarding this.

Anyhow my points are there to morphan, and thankyou for the support.

The poblem which i raised in this is closely matches with a Oracle Bug, and since there is no patch version for the version, i have to go for 9.2 version.


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL query of Oracle 10g database. 8 76
File generation using utl_file 4 45
case statement in where clause 5 41
Get the parent node - XMLTYPE 9 56
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now