[Geoserver-devel] [jira] Created: (GEOS-232) Intersects on Oracle is not working correctly

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/GEOS-232

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: GEOS-232
    Summary: Intersects on Oracle is not working correctly
       Type: Bug

     Status: Open
   Priority: Major

Original Estimate: 1 day
Time Spent: Unknown
  Remaining: 1 day

    Project: GeoServer
Components:
             WFS
             Oracle
   Versions:
             1.2.3

   Assignee: Sean Geoghegan
   Reporter: Thijs Brentjens

    Created: Mon, 25 Oct 2004 10:36 AM
    Updated: Mon, 25 Oct 2004 10:36 AM
Environment: Oracle 10G, windows XP, Geoserver 1.2.3

Description:
When using the Intersects filter as in:

<?xml version="1.0" encoding="iso-8859-1"?>
<GetFeature outputFormat="GML2" xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<Query typeName="scs:ADAM_ANDES">
<PropertyName>scs:GEOM</PropertyName>
<Filter>
  <Intersects>
    <PropertyName>GEOM</PropertyName>
    <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#28992&quot;&gt;
      <gml:coordinates>120173,489015 120818,489717</gml:coordinates>
    </gml:Box>
  </Intersects>
</Filter>
</Query>
</GetFeature>

The JDBCFeatureSource sends this SQL to the Oracle database, according to the logfile:

SELECT COUNT(*) as cnt FROM ADAM_ANDES WHERE NOT SDO_RELATE("GEOM",MDSYS.SDO_GEOMETRY(2003,90112,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(120173.0,489015.0,120173.0,489717.0,120818.0,489717.0,120818.0,489015.0,120173.0,489015.0)),'mask=disjoint querytype=WINDOW') = 'TRUE'

This SQL is not working properly on Oracle 10G (when sending it from an Oracle client I've waited for minutes and the SQL was still executing).

However, the SQL (with ANYINTERACT in stead of NOT DISJOINT) below returns cnt in around 0.5 seconds maximum on my configuration.

SELECT COUNT(*) as cnt FROM ADAM_ANDES WHERE SDO_RELATE("GEOM",MDSYS.SDO_GEOMETRY(2003,90112,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(120173.0,489015.0,120173.0,489717.0,120818.0,489717.0,120818.0,489015.0,120173.0,489015.0)),'mask=anyinteract querytype=WINDOW') = 'TRUE'

For Oracle users it would be a great improvement if this could be fixed.

---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

It's really that much slower? Is a 'disjoint' also as slow? It should
just be a NOT in front of the disjoint, which shouldn't be much slower.

The reason I changed away from ANYINTERACT is that it doesn't actually
return the same Features that a 'NOT DISJOINT' does. By the OGC specs
DISJOINT and INTERSECTS should be the exact opposite (along with BBOX). I
know oracle docs say something about anyinteract being features that
aren't disjoint, but it never directly says that they are _exactly_ that.
So I changed it to comply exactly, but I didn't do any scalability tests.
I would consider a 'loose bbox' option with oracle, similar to postgis,
where bbox would do 'anyinteract', but I think intersects should be sure
that it is exactly the same as not disjoint. Go ahead and test this, if
you can't reproduce it, if anyinteract really is the same as not disjoint
for you, then I'm willing to change it back. But I find it weird that
it's such a speed difference. Maybe try to issue a <NOT><DISJOINT>
filter, and see if it takes as long, and if it's encoded any differently
than the INTERSECTS.

best regards,

Chris

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/GEOS-232

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: GEOS-232
    Summary: Intersects on Oracle is not working correctly
       Type: Bug

     Status: Open
   Priority: Major

Original Estimate: 1 day
Time Spent: Unknown
  Remaining: 1 day

    Project: GeoServer
Components:
             WFS
             Oracle
   Versions:
             1.2.3

   Assignee: Sean Geoghegan
   Reporter: Thijs Brentjens

    Created: Mon, 25 Oct 2004 10:36 AM
    Updated: Mon, 25 Oct 2004 10:36 AM
Environment: Oracle 10G, windows XP, Geoserver 1.2.3

Description:
When using the Intersects filter as in:

<?xml version="1.0" encoding="iso-8859-1"?>
<GetFeature outputFormat="GML2" xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<Query typeName="scs:ADAM_ANDES">
<PropertyName>scs:GEOM</PropertyName>
<Filter>
  <Intersects>
    <PropertyName>GEOM</PropertyName>
    <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#28992&quot;&gt;
      <gml:coordinates>120173,489015 120818,489717</gml:coordinates>
    </gml:Box>
  </Intersects>
</Filter>
</Query>
</GetFeature>

The JDBCFeatureSource sends this SQL to the Oracle database, according to the logfile:

SELECT COUNT(*) as cnt FROM ADAM_ANDES WHERE NOT SDO_RELATE("GEOM",MDSYS.SDO_GEOMETRY(2003,90112,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(120173.0,489015.0,120173.0,489717.0,120818.0,489717.0,120818.0,489015.0,120173.0,489015.0)),'mask=disjoint querytype=WINDOW') = 'TRUE'

This SQL is not working properly on Oracle 10G (when sending it from an Oracle client I've waited for minutes and the SQL was still executing).

However, the SQL (with ANYINTERACT in stead of NOT DISJOINT) below returns cnt in around 0.5 seconds maximum on my configuration.

SELECT COUNT(*) as cnt FROM ADAM_ANDES WHERE SDO_RELATE("GEOM",MDSYS.SDO_GEOMETRY(2003,90112,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(120173.0,489015.0,120173.0,489717.0,120818.0,489717.0,120818.0,489015.0,120173.0,489015.0)),'mask=anyinteract querytype=WINDOW') = 'TRUE'

For Oracle users it would be a great improvement if this could be fixed.

---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--

At 20:44 25-10-2004, Chris Holmes wrote:

It's really that much slower? Is a 'disjoint' also as slow? It should
just be a NOT in front of the disjoint, which shouldn't be much slower.

Disjoint is not supported in SDO_RELATE, that is SDO_RELATE actually does not allow DISJOINT as a mask(for 10g). See e.g. https://cwisdb.cc.kuleuven.ac.be/ora10doc/appdev.101/b10826/sdo_operat.htm#i78531 :

"Valid mask keyword values are one or more of the following in the nine-intersection pattern: TOUCH, OVERLAPBDYDISJOINT, OVERLAPBDYINTERSECT, EQUAL, INSIDE, COVEREDBY, CONTAINS, COVERS, ANYINTERACT, ON. Multiple masks are combined with the logical Boolean operator OR, for example, 'mask=inside+touch'; however, see the Usage Notes for an alternative syntax using UNION ALL that may result in better performance. See Section 1.8 for an explanation of the nine-intersection relationship pattern.

For backward compatibility, any additional keywords for the param parameter that were supported in the previous release will still work; however, the use of those keywords is discouraged and is not supported for new uses of the operator."

So the way Geoserver makes the SQL is actually not correct (at least when using SDO_RELATE in 10g it is not), although it'll work.
It seems that Oracle does it the other way around: the filter <Intersects> uses the mask ANYINTERACT best, while <Disjoint> is something like NOT ANYINTERACT.

The reason I changed away from ANYINTERACT is that it doesn't actually
return the same Features that a 'NOT DISJOINT' does.

That would be nasty...

By the OGC specs DISJOINT and INTERSECTS should be the exact opposite (along with BBOX). I
know oracle docs say something about anyinteract being features that
aren't disjoint, but it never directly says that they are _exactly_ that.
So I changed it to comply exactly, but I didn't do any scalability tests.
I would consider a 'loose bbox' option with oracle, similar to postgis,
where bbox would do 'anyinteract', but I think intersects should be sure
that it is exactly the same as not disjoint. Go ahead and test this, if
you can't reproduce it, if anyinteract really is the same as not disjoint
for you, then I'm willing to change it back. But I find it weird that
it's such a speed difference.

I've tested the (Oracle) SQL-statements on one of my tables, with the most records. ANYINTERSECT gives the same results as NOT DISJOINT. However, ANYINTERSECT is a lot faster than NOT DISJOINT (a split second compared to minutes...). (Maybe this depends on the size of the box, where a relatively small box (say 1 sq.km compared to the bounding box of the data in the table, say 100 sq.km) is easy to calculate an intersect with anyinteract, while in case of a large box (e.g. 81 sq.km compared to 100 sq.km) it would be faster to use the disjoint mask. But for most applications , I think the box to use in the intersect-filter will be relatively small. This is just a wild guess though, and not very useful now :))

But I can't guarantee that the results will always be the same for ANYINTERACT and NOT DISJOINT... Because there is something strange happening: while ANYINTERSECT and NOT DISJOINT give the same results, NOT ANYINTERACT and DISJOINT do not give the same results. I'll try to figure out why, but anyway, for Oracle 10g users I think it would be better that for Intersects ANYINTERACT will be used. Maybe the best solution is that I try to fix that locally, test it and report later on to the Geoserver-list/Jira. Otherwise maybe somebody (you) would make some changes that have to be undone (again).

Maybe try to issue a <NOT><DISJOINT>
filter, and see if it takes as long, and if it's encoded any differently
than the INTERSECTS.
best regards,

It takes as long as well and it seems to be encoded the same, using ' mask=disjoint...' in the SQL for Oracle.

Chris

Okay, maybe best is I'll test somemore and let know what happens.

Best regards,

Thijs

> Message:
>
> A new issue has been created in JIRA.
>
> ---------------------------------------------------------------------
> View the issue:
> http://jira.codehaus.org/browse/GEOS-232
>
> Here is an overview of the issue:
> ---------------------------------------------------------------------
> Key: GEOS-232
> Summary: Intersects on Oracle is not working correctly
> Type: Bug
>
> Status: Open
> Priority: Major
>
> Original Estimate: 1 day
> Time Spent: Unknown
> Remaining: 1 day
>
> Project: GeoServer
> Components:
> WFS
> Oracle
> Versions:
> 1.2.3
>
> Assignee: Sean Geoghegan
> Reporter: Thijs Brentjens
>
> Created: Mon, 25 Oct 2004 10:36 AM
> Updated: Mon, 25 Oct 2004 10:36 AM
> Environment: Oracle 10G, windows XP, Geoserver 1.2.3
>
> Description:
> When using the Intersects filter as in:
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <GetFeature outputFormat="GML2" xmlns:gml="http://www.opengis.net/gml&quot;&gt;
> <Query typeName="scs:ADAM_ANDES">
> <PropertyName>scs:GEOM</PropertyName>
> <Filter>
> <Intersects>
> <PropertyName>GEOM</PropertyName>
> <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#28992&quot;&gt;
> <gml:coordinates>120173,489015 120818,489717</gml:coordinates>
> </gml:Box>
> </Intersects>
> </Filter>
> </Query>
> </GetFeature>
>
> The JDBCFeatureSource sends this SQL to the Oracle database, according to the logfile:
>
> SELECT COUNT(*) as cnt FROM ADAM_ANDES WHERE NOT SDO_RELATE("GEOM",MDSYS.SDO_GEOMETRY(2003,90112,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(120173.0,489015.0,120173.0,489717.0,120818.0,489717.0,120818.0,489015.0,120173.0,489015.0)),'mask=disjoint querytype=WINDOW') = 'TRUE'
>
> This SQL is not working properly on Oracle 10G (when sending it from an Oracle client I've waited for minutes and the SQL was still executing).
>
> However, the SQL (with ANYINTERACT in stead of NOT DISJOINT) below returns cnt in around 0.5 seconds maximum on my configuration.
>
> SELECT COUNT(*) as cnt FROM ADAM_ANDES WHERE SDO_RELATE("GEOM",MDSYS.SDO_GEOMETRY(2003,90112,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(120173.0,489015.0,120173.0,489717.0,120818.0,489717.0,120818.0,489015.0,120173.0,489015.0)),'mask=anyinteract querytype=WINDOW') = 'TRUE'
>
> For Oracle users it would be a great improvement if this could be fixed.
>
> ---------------------------------------------------------------------
> JIRA INFORMATION:
> This message is automatically generated by JIRA.
>
> If you think it was sent incorrectly contact one of the administrators:
> http://jira.codehaus.org/secure/Administrators.jspa
>
> If you want more information on JIRA, or have a bug to report see:
> http://www.atlassian.com/software/jira
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
> Use IT products in your business? Tell us what you think of them. Give us
> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
> http://productguide.itmanagersjournal.com/guidepromo.tmpl
> _______________________________________________
> Geoserver-devel mailing list
> Geoserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>

--

-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel