Unix Technical Forum

Problem with XMLType indexing. Please confirm

This is a discussion on Problem with XMLType indexing. Please confirm within the Oracle Database forums, part of the Database Server Software category; --> Hello, i posted this a few months ago on comp.databases.oracle.misc, but got no reaction at all. So here is ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-24-2008, 03:23 PM
Ko van der Sloot
 
Posts: n/a
Default Problem with XMLType indexing. Please confirm

Hello,
i posted this a few months ago on comp.databases.oracle.misc, but got no
reaction at all. So here is a retry on comp.databases.oracle.server

Below you'l find a self contained script, which, after adding a
ctxsys.CTXXPATH index, produces very strange results.
i.c: (A OR B) gives 4 hits where (B OR A) gives 5 hits.

It's not clear to me if this is due to some wrong ideas about XMLType or
a misbeahaving of Oracle.
I would be very pleased if some of your good people try the script on
various Orcacle versions and report their findings.

Our Orcale version:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

We get the following counts out of this script:
3, 3, 3, 5
The last number is unbelievable WRONG!

thanks for your help
Ko vd Sloot
Tilburg University

here is the script: (maybe needs some reformating)
================================================== ==========
drop table bug;

create table bug ( doc_id NUMBER, data_char xmltype );
insert into bug values( 1, XMLType(
'<document>
<ti>Test 1</ti>
<py>2002</py>
</document>' ) );

insert into bug values( 2, XMLType(
'<document>
<ti>Test 2</ti>
<py>2002</py>
</document>' ) );

insert into bug values( 3, XMLType(
'<document>
<ti>Test 3</ti>
<py>2003</py>
</document>' ) );

insert into bug values( 4, XMLType(
'<document>
<ti>Test 4</ti>
<py>2002</py>
</document>' ) );

insert into bug values( 5, XMLType(
'<document>
<ti>Test 5</ti>
<py>2003</py>
</document>' ) );

create index my_idx on bug(data_char) indextype is ctxsys.context;

select count( doc_id ) from bug where
existsNode(data_char,'//py[.>"2002"]') > 0 OR contains(data_char,'2
inpath(//ti)' ) > 0;

select count( doc_id ) from bug where contains(data_char,'2
inpath(//ti)' ) > 0 OR existsNode(data_char,'//py[.>"2002"]') > 0;

create index my_x_idx on bug(data_char) indextype is ctxsys.CTXXPATH;

select count( doc_id ) from bug where
existsNode(data_char,'//py[.>"2002"]') > 0 OR contains(data_char,'2
inpath(//ti)' ) > 0;

select count( doc_id ) from bug where contains(data_char,'2
inpath(//ti)' ) > 0 OR existsNode(data_char,'//py[.>"2002"]') > 0;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-24-2008, 03:28 PM
Michael O'Shea
 
Posts: n/a
Default Re: Problem with XMLType indexing. Please confirm

Hello Ko. I have attempted to look into this behaviour for you. I
pasted your script verbatim into 10g release 10.1.0.2.0 personal on
Windows XP. The behaviour you observe in 9i is not reproducible in 10g.
Full details are included in the trace below. I suggest you look at
metalink for the bug fix.
Kind regards
Mike

TESSELLA Michael.OShea@tessella.com
__/__/__/ Tessella Support Services plc
__/__/__/ 3 Vineyard Chambers, ABINGDON, OX14 3PX, England
__/__/__/ Tel: (44)(0)1235-555511 Fax: (44)(0)1235-553301
http://www.tessella.com Registered in England No. 1466429



SQL>
SQL> drop table bug;

Table dropped.

SQL>
SQL> create table bug ( doc_id NUMBER, data_char xmltype );

Table created.

SQL> insert into bug values( 1, XMLType(
2 '<document>
3 <ti>Test 1</ti>
4 <py>2002</py>
5 </document>' ) );

1 row created.

SQL>
SQL> insert into bug values( 2, XMLType(
2 '<document>
3 <ti>Test 2</ti>
4 <py>2002</py>
5 </document>' ) );

1 row created.

SQL>
SQL> insert into bug values( 3, XMLType(
2 '<document>
3 <ti>Test 3</ti>
4 <py>2003</py>
5 </document>' ) );

1 row created.

SQL>
SQL> insert into bug values( 4, XMLType(
2 '<document>
3 <ti>Test 4</ti>
4 <py>2002</py>
5 </document>' ) );

1 row created.

SQL>
SQL> insert into bug values( 5, XMLType(
2 '<document>
3 <ti>Test 5</ti>
4 <py>2003</py>
5 </document>' ) );

1 row created.

SQL>
SQL> create index my_idx on bug(data_char) indextype is ctxsys.context;

Index created.

SQL>
SQL> select count( doc_id ) from bug where
2 existsNode(data_char,'//py[.>"2002"]') > 0 OR
contains(data_char,'2
3 inpath(//ti)' ) > 0;

COUNT(DOC_ID)

-------------

3


SQL>
SQL> select count( doc_id ) from bug where contains(data_char,'2
2 inpath(//ti)' ) > 0 OR existsNode(data_char,'//py[.>"2002"]') >
0;

COUNT(DOC_ID)

-------------

3


SQL>
SQL> create index my_x_idx on bug(data_char) indextype is
ctxsys.CTXXPATH;

Index created.

SQL>
SQL> select count( doc_id ) from bug where
2 existsNode(data_char,'//py[.>"2002"]') > 0 OR
contains(data_char,'2
3 inpath(//ti)' ) > 0;

COUNT(DOC_ID)

-------------

3


SQL>
SQL> select count( doc_id ) from bug where contains(data_char,'2
2 inpath(//ti)' ) > 0 OR existsNode(data_char,'//py[.>"2002"]') >
0;

COUNT(DOC_ID)

-------------

3


SQL> SELECT *
2 FROM V$VERSION;

BANNER

----------------------------------------------------------------

Personal Oracle Database 10g Release 10.1.0.2.0 - Production

PL/SQL Release 10.1.0.2.0 - Production

CORE 10.1.0.2.0 Production

TNS for 32-bit Windows: Version 10.1.0.2.0 - Production

NLSRTL Version 10.1.0.2.0 - Production


SQL> SPOOL OFF



Ko van der Sloot wrote:
> Hello,
> i posted this a few months ago on comp.databases.oracle.misc, but got no
> reaction at all. So here is a retry on comp.databases.oracle.server
>
> Below you'l find a self contained script, which, after adding a
> ctxsys.CTXXPATH index, produces very strange results.
> i.c: (A OR B) gives 4 hits where (B OR A) gives 5 hits.
>
> It's not clear to me if this is due to some wrong ideas about XMLType or
> a misbeahaving of Oracle.
> I would be very pleased if some of your good people try the script on
> various Orcacle versions and report their findings.
>
> Our Orcale version:
> Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
> With the Partitioning, OLAP and Oracle Data Mining options
> JServer Release 9.2.0.4.0 - Production
>
> We get the following counts out of this script:
> 3, 3, 3, 5
> The last number is unbelievable WRONG!
>
> thanks for your help
> Ko vd Sloot
> Tilburg University
>
> here is the script: (maybe needs some reformating)
> ================================================== ==========
> drop table bug;
>
> create table bug ( doc_id NUMBER, data_char xmltype );
> insert into bug values( 1, XMLType(
> '<document>
> <ti>Test 1</ti>
> <py>2002</py>
> </document>' ) );
>
> insert into bug values( 2, XMLType(
> '<document>
> <ti>Test 2</ti>
> <py>2002</py>
> </document>' ) );
>
> insert into bug values( 3, XMLType(
> '<document>
> <ti>Test 3</ti>
> <py>2003</py>
> </document>' ) );
>
> insert into bug values( 4, XMLType(
> '<document>
> <ti>Test 4</ti>
> <py>2002</py>
> </document>' ) );
>
> insert into bug values( 5, XMLType(
> '<document>
> <ti>Test 5</ti>
> <py>2003</py>
> </document>' ) );
>
> create index my_idx on bug(data_char) indextype is ctxsys.context;
>
> select count( doc_id ) from bug where
> existsNode(data_char,'//py[.>"2002"]') > 0 OR contains(data_char,'2
> inpath(//ti)' ) > 0;
>
> select count( doc_id ) from bug where contains(data_char,'2
> inpath(//ti)' ) > 0 OR existsNode(data_char,'//py[.>"2002"]') > 0;
>
> create index my_x_idx on bug(data_char) indextype is ctxsys.CTXXPATH;
>
> select count( doc_id ) from bug where
> existsNode(data_char,'//py[.>"2002"]') > 0 OR contains(data_char,'2
> inpath(//ti)' ) > 0;
>
> select count( doc_id ) from bug where contains(data_char,'2
> inpath(//ti)' ) > 0 OR existsNode(data_char,'//py[.>"2002"]') > 0;


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-24-2008, 03:30 PM
Ko van der Sloot
 
Posts: n/a
Default Re: Problem with XMLType indexing. Please confirm

Michael O'Shea wrote:
> Hello Ko. I have attempted to look into this behaviour for you. I
> pasted your script verbatim into 10g release 10.1.0.2.0 personal on
> Windows XP. The behaviour you observe in 9i is not reproducible in 10g.


Thanx. Good to hear.
This gives me more ammunition to force an upgrade to 10g
I'm just a user, fighting the DBA

> Full details are included in the trace below. I suggest you look at
> metalink for the bug fix.


I will contact my DBA about this.
But as you might know, big wheels keep on turning slowly...

> Kind regards
> Mike


Tanks again
Ko
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:57 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com