Basic Spatial Query

Hi guys,
I am currently developing a java applet to display telecommunication sites taken from an Oracle 8.1.6 DB. The company I work for also happens to have the spatial cartridge which I intend to use to overlay a country map over my plottings. I have imported the map data into a table, and I can view the GEOLOC information as a huge stream of longs and lats via a simple SELECT query in SQLPLUS - so the data has been imported correctly.
I have tried to digest huge articles on querying spatial information - however, unfortunately being an Oracle novice, it has left me quite dazzled.
Basically all I want to do is take from my spatial table a list of long and lat coordinates (in double format) in a specific physical area, so that I can display them from there.
I'd appreciate any help that anyone could give.
null

Hi David,
There are a few things you will have to do in order to get this to work quickly.
1) You will have to insert data into the user_sdo_geom_metadata field so Oracle Spatial can know some information about the data you've created (table name, spatial column name, information about upper and lower bounds as well as tolerance for each dimension.
2) You'll need to create a spatial index on the data.
3) You'll need to analyze the spatial index table.
4) Then you can query the data. You'll have to decide whether you need exact answers (using the sdo_relate operator) or approximate answers based only on the index (sdo_filter operator).
There is too much information required to put it all here, but I'll include a few samples.
to insert data into user_sdo_geom_metadata:
insert into user_sdo_geom_metadata values ('TABLE_NAME','GEOMETRY_COLUMN_NAME',
mdsys.sdo_dim_array(mdsys.sdo_dim_element('X',-180.0,180,0.00000005),
mdsys.sdo_dim_element('Y',-90,90,0.00000005)),NULL);
commit;
In the above example, TABLE_NAME is the name of the table with your geometry column, then the geometry column name, then the dimarray has attributes in it associated with each of two dimensions (two dimensional data is stored here), the first dimension has a lower bound of -180, and upper bound of 180, and a tolerance or 0.00000005 (the decimal precision of your data, with a 5 appended), the second dimension has the info supplied, and the last null means there is no coordinate system stored with the data. I'd suggest if you are a newbie to leave it as NULL, then ease into coordinate systems once you get more experience.
2) create the index
create index table_name_sidx
on table_name(geometry_column_name)
indextype is mdsys.spatial_index
parameters('sdo_level=x');
where x is usually a number between 6 and 14 based on the type of data you have. There is a lot to say about this, but I can't say it here.
3) analyze the spatial index table:
from sql*plus, run the following statements:
set head off
spool analyze_it.sql
select ' analyze table ' | | sdo_index_table | | ' estimate statistics sample 32 percent;'
from user_sdo_index_metadata order by sdo_index_table;
spool off;
@analyze_it.sql
4) execute a query based on an area of interest:
this statement will return all geometries that have any interaction with a query window specified by a rectangle with bounds
2,2, 10,2, 10,10, 2,10, 2,2
SELECT geometry_column_name
FROM table_name
where sdo_relate (geometry_column_name,
mdsys.sdo_geometry(2003,NULL, NULL
mdsys.sdo_elem_info_array(1,1003,1),
mdsys.sdo_ordinate_array (2,2, 10,2, 10,10, 2,10, 2,2)),
'mask=anyinteract querytype=window'
= 'TRUE';
You will have to dig more into each of these subject to understand them.
Hope this helps,
dan
null

Similar Messages

  • Problems with basic spatial query

    I'm trying to learn Oracle Spatial working with 11g R2 and with 3D georeferenced data (specifically data describing buildings in a city).
    But I'm having trouble getting a basic query to work on my dataset (it works for the book example), and I'm trying to do it exactly the way it's done in the Spatial Developer's Guide for 11g.
    To learn how spatial queries work, I set up the cola_markets tables used in the documentation, made the appropriate manual entry in the user_sdo_geom_metadata view and created the index. Having done that, I can run the following simple query (as well as the others in the manual) on the book tables:
    SELECT SDO_GEOM.SDO_DISTANCE(c_b.shape, c_d.shape, 0.005)
    FROM cola_markets c_b, cola_markets c_d
    WHERE c_b.name = 'cola_b' AND c_d.name = 'cola_d';
    but when I try to do the same thing on my own tables (created from citygml data), I get an error. There is the difference that the data is 3D, and the index was created without any PARAMETERS ( ... ), hence is just 2D. But still I don't get why the following query doesn't work:
    SELECT SDO_GEOM.SDO_DISTANCE(c_w.envelope, c_b.envelope, 0.0005)
    FROM cityobject c_w,
    cityobject c_b
    WHERE c_w.id = 50025
    AND c_b.id = 50018;
    The id's for the buildings are valid, and I used the same tolerance used by the software that set up the database.
    Here's the error I get in SQL developer:
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.Exception: 54535
    ORA-06512: at "MDSYS.SDO_3GL", line 637
    ORA-06512: at "MDSYS.SDO_GEOM", line 1973
    ORA-06512: at "MDSYS.SDO_GEOM", line 1990
    29532. 00000 - "Java call terminated by uncaught Java exception: %s"
    *Cause: A Java exception or error was signaled and could not be
    resolved by the Java code.
    *Action: Modify Java code, if this behavior is not intended.
    So, thinking it might have something to do with the fact that it's a Java interface, I also tried running it from SQL/PL command line and get essentially the same thing:
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.Exception: 54535
    ORA-06512: at "MDSYS.SDO_3GL", line 637
    ORA-06512: at "MDSYS.SDO_GEOM", line 1973
    ORA-06512: at "MDSYS.SDO_GEOM", line 1990
    Any ideas why this isn't working?

    Hi,-
    There are many ways to model a building with our open 3D data model:
    Please note that each polygon can be any planar surface as long as you dont use
    shortcut definitions like axis-aligned box as Siva mentioned. We dont allow curved surfaces in 3D.
    Gtype 3003 can be composite surface which means each polygon should be connected to another polygon with an edge. Etype must be then 1006. You can have as many polygons as possible as long as they are connected.
    Gtype 3003 can also be a single polygon. But, this will not be able to model a building.
    As you pointed out, maybe it is the footprint of the building.
    You can also model building with gtype 3008 which is simple or composite solid.
    Etype 1007 means it is simple solid and etype 1008 means it is composite solid.
    Composite solid has one or more solids which has at least one full or partial common surface in between.
    In your case with single polygon, you can use sdo_util.extrude as follows to make
    3D buildings. The surfaces created will be on the out-side surface of the building.
    You will not have walls inside the building when you use this following function:
    SELECT SDO_UTIL.EXTRUDE(
      SDO_GEOMETRY(
        2003,
        null,
        null,
        SDO_ELEM_INFO_ARRAY(1,1003,1),
        SDO_ORDINATE_ARRAY(5, 1,8,1,8,6,5,7,5,1)),
      SDO_NUMBER_ARRAY(0,0,0,0,0),
      SDO_NUMBER_ARRAY(5,10,10,5,5),
      0.005) from dual;
    SDO_UTIL.EXTRUDE(SDO_GEOMETRY(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,1),SDO_O
    SDO_GEOMETRY(3008, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1007, 1, 1, 1006, 6, 1, 10
    03, 1, 16, 1003, 1, 31, 1003, 1, 46, 1003, 1, 61, 1003, 1, 76, 1003, 1), SDO_ORD
    INATE_ARRAY(5, 1, 0, 5, 7, 0, 8, 6, 0, 8, 1, 0, 5, 1, 0, 5, 1, 5, 8, 1, 10, 8, 6
    , 10, 5, 7, 5, 5, 1, 5, 5, 1, 0, 8, 1, 0, 8, 1, 10, 5, 1, 5, 5, 1, 0, 8, 1, 0, 8
    , 6, 0, 8, 6, 10, 8, 1, 10, 8, 1, 0, 8, 6, 0, 5, 7, 0, 5, 7, 5, 8, 6, 10, 8, 6,
    0, 5, 7, 0, 5, 1, 0, 5, 1, 5, 5, 7, 5, 5, 7, 0))
    The following example returns the three-dimensional composite solid geometry representing an extrusion from a two-dimensional polygon geometry with inner rings.
    SELECT SDO_UTIL.EXTRUDE(
      SDO_GEOMETRY(
        2003,
        null,
        null,
        SDO_ELEM_INFO_ARRAY(1, 1003, 1, 11, 2003, 1,
          21, 2003,1, 31,2003,1, 41, 2003, 1),
        SDO_ORDINATE_ARRAY(0,0, 8,0, 8,8, 0,8, 0,0,
          1,3, 1,4, 2,4, 2,3, 1,3, 1,1, 1,2, 2,2, 2,1, 1,1,
          1,6, 1,7, 2,7, 2,6, 1,6, 3,2, 3,4, 4,4, 4,2, 3,2)),
      SDO_NUMBER_ARRAY(-1.0),
      SDO_NUMBER_ARRAY(1.0),
      0.0001) from dual;
    SDO_UTIL.EXTRUDE(SDO_GEOMETRY(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,1,11,200
    SDO_GEOMETRY(3008, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1008, 4, 1, 1007, 1, 1, 10
    06, 16, 1, 1003, 1, 46, 1003, 1, 91, 1003, 1, 106, 1003, 1, 121, 1003, 1, 136, 1
    003, 1, 151, 1003, 1, 166, 1003, 1, 181, 1003, 1, 196, 1003, 1, 211, 1003, 1, 22
    6, 1003, 1, 241, 1003, 1, 256, 1003, 1, 271, 1003, 1, 286, 1003, 1, 301, 1007, 1
    , 301, 1006, 10, 301, 1003, 1, 328, 1003, 1, 355, 1003, 1, 370, 1003, 1, 385, 10
    03, 1, 400, 1003, 1, 415, 1003, 1, 430, 1003, 1, 445, 1003, 1, 460, 1003, 1, 475
    , 1007, 1, 475, 1006, 6, 475, 1003, 1, 490, 1003, 1, 505, 1003, 1, 520, 1003, 1,
    535, 1003, 1, 550, 1003, 1, 565, 1007, 1, 565, 1006, 10, 565, 1003, 1, 592, 100
    3, 1, 619, 1003, 1, 634, 1003, 1, 649, 1003, 1, 664, 1003, 1, 679, 1003, 1, 694,
    1003, 1, 709, 1003, 1, 724, 1003, 1), SDO_ORDINATE_ARRAY(4, 0, -1, 4, 2, -1, 4,
    4, -1, 3, 4, -1, 2, 4, -1, 2, 7, -1, 1, 7, -1, 1, 6, -1, 1, 4, -1, 1, 3, -1, 0,
    3, -1, 0, 8, -1, 8, 8, -1, 8, 0, -1, 4, 0, -1, 4, 0, 1, 8, 0, 1, 8, 8, 1, 0, 8,
    1, 0, 3, 1, 1, 3, 1, 1, 4, 1, 1, 6, 1, 1, 7, 1, 2, 7, 1, 2, 4, 1, 3, 4, 1, 4, 4
    , 1, 4, 2, 1, 4, 0, 1, 4, 0, -1, 8, 0, -1, 8, 0, 1, 4, 0, 1, 4, 0, -1, 8, 0, -1,
    8, 8, -1, 8, 8, 1, 8, 0, 1, 8, 0, -1, 8, 8, -1, 0, 8, -1, 0, 8, 1, 8, 8, 1, 8,
    8, -1, 0, 8, -1, 0, 3, -1, 0, 3, 1, 0, 8, 1, 0, 8, -1, 0, 3, -1, 1, 3, -1, 1, 3,
    1, 0, 3, 1, 0, 3, -1, 1, 3, -1, 1, 4, -1, 1, 4, 1, 1, 3, 1, 1, 3, -1, 1, 4, -1,
    1, 6, -1, 1, 6, 1, 1, 4, 1, 1, 4, -1, 1, 6, -1, 1, 7, -1, 1, 7, 1, 1, 6, 1, 1,
    6, -1, 1, 7, -1, 2, 7, -1, 2, 7, 1, 1, 7, 1, 1, 7, -1, 2, 7, -1, 2, 4, -1, 2, 4,
    1, 2, 7, 1, 2, 7, -1, 2, 4, -1, 3, 4, -1, 3, 4, 1, 2, 4, 1, 2, 4, -1, 3, 4, -1,
    4, 4, -1, 4, 4, 1, 3, 4, 1, 3, 4, -1, 4, 4, -1, 4, 2, -1, 4, 2, 1, 4, 4, 1, 4,
    4, -1, 4, 2, -1, 4, 0, -1, 4, 0, 1, 4, 2, 1, 4, 2, -1, 0, 3, -1, 1, 3, -1, 1, 1,
    -1, 2, 1, -1, 3, 2, -1, 4, 2, -1, 4, 0, -1, 0, 0, -1, 0, 3, -1, 0, 3, 1, 0, 0,
    1, 4, 0, 1, 4, 2, 1, 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 3, 1, 0, 3, 1, 0, 3, -1, 0, 0
    , -1, 0, 0, 1, 0, 3, 1, 0, 3, -1, 0, 0, -1, 4, 0, -1, 4, 0, 1, 0, 0, 1, 0, 0, -1
    , 4, 0, -1, 4, 2, -1, 4, 2, 1, 4, 0, 1, 4, 0, -1, 4, 2, -1, 3, 2, -1, 3, 2, 1, 4
    , 2, 1, 4, 2, -1, 3, 2, -1, 2, 1, -1, 2, 1, 1, 3, 2, 1, 3, 2, -1, 2, 1, -1, 1, 1
    , -1, 1, 1, 1, 2, 1, 1, 2, 1, -1, 1, 1, -1, 1, 3, -1, 1, 3, 1, 1, 1, 1, 1, 1, -1
    , 1, 3, -1, 0, 3, -1, 0, 3, 1, 1, 3, 1, 1, 3, -1, 1, 6, -1, 2, 6, -1, 2, 4, -1,
    1, 4, -1, 1, 6, -1, 1, 6, 1, 1, 4, 1, 2, 4, 1, 2, 6, 1, 1, 6, 1, 1, 6, -1, 1, 4,
    -1, 1, 4, 1, 1, 6, 1, 1, 6, -1, 1, 4, -1, 2, 4, -1, 2, 4, 1, 1, 4, 1, 1, 4, -1,
    2, 4, -1, 2, 6, -1, 2, 6, 1, 2, 4, 1, 2, 4, -1, 2, 6, -1, 1, 6, -1, 1, 6, 1, 2,
    6, 1, 2, 6, -1, 1, 3, -1, 2, 3, -1, 2, 4, -1, 3, 4, -1, 3, 2, -1, 2, 1, -1, 2,
    2, -1, 1, 2, -1, 1, 3, -1, 1, 3, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 3, 2, 1, 3, 4, 1,
    2, 4, 1, 2, 3, 1, 1, 3, 1, 1, 3, -1, 1, 2, -1, 1, 2, 1, 1, 3, 1, 1, 3, -1, 1, 2
    , -1, 2, 2, -1, 2, 2, 1, 1, 2, 1, 1, 2, -1, 2, 2, -1, 2, 1, -1, 2, 1, 1, 2, 2, 1
    , 2, 2, -1, 2, 1, -1, 3, 2, -1, 3, 2, 1, 2, 1, 1, 2, 1, -1, 3, 2, -1, 3, 4, -1,
    3, 4, 1, 3, 2, 1, 3, 2, -1, 3, 4, -1, 2, 4, -1, 2, 4, 1, 3, 4, 1, 3, 4, -1, 2, 4
    , -1, 2, 3, -1, 2, 3, 1, 2, 4, 1, 2, 4, -1, 2, 3, -1, 1, 3, -1, 1, 3, 1, 2, 3, 1
    , 2, 3, -1))These are examples from Spatial User's Guide.
    ORA-54668 means that you need to update your srid to a 3D srid.
    Please check out Spatial User's Guide, Pro Oracle Spatial for 11g book and
    the following paper (which we can send you a copy offline)
    B. M. Kazar, R. Kothuri, P. v. Oosterom and S. Ravada, "On Valid and Invalid Three-
    Dimensional Geometries", 2nd International Workshop on 3D Geo-Information: Requirements, Acquisition,
    Modelling, Analysis, Visualisation, 12-14 December 2007, Delft, the Netherlands (Published as Chapter 2,
    pp. 19-46 in Advances in 3D Geoinformation Systems Series: Lecture Notes in Geoinformation and
    Cartography Oosterom, P.v.; Zlatanova, S.; Penninga, F.; Fendel, E. (Eds.) 2008, XX, 441 p. 235 illus.,
    Hardcover ISBN: 978-3-540-72134-5
    Maybe if you can post here an example geometry from your data,
    we can help you more.
    Hope these help.
    Thanks

  • Spatial Query, Use Multiple Cores

    Basic question, is SQL 2012 running on Windows 2008 R2 64 bit expected to use multiple cores to execute it's tasks?
    I have a table of points, 480, that has 3 empty columns that are being updated from 3 separate tables of polygons via a spatial join based on an intersection (STIntersects) of the point and polygons. All of the data is in 4326 and all tables have spatial
    indexes.
    The server running this query has 32 logical cores, but only 1 core is used and it is maxed out. It takes 53 seconds to complete the update. I have over a million points that need this done. I want to assume that if SQL can access more cores it will complete
    faster.
    I've looked at the actual execution plan and there is a 99% cost on the spatial query.
    update A
    set CONGRESS_DISTRICT = B.DISTRICT, HOUSE_DISTRICT = C.DISTRICT, SENATE_DISTRICT = D.DISTRICT
    from [LegislativeMapData2014].[dbo].[CNRM_INFORCE_EXTRACT093014_COMBINED_GEOCODED] A
    inner join [LegislativeMapData2014].[dbo].[CONGRESS_2014] B
    on A.FEATURE_SHAPE.STIntersects(B.FEATURE_SHAPE) = 1
    inner join [LegislativeMapData2014].[dbo].[HOUSE_2014] C
    on A.FEATURE_SHAPE.STIntersects(C.FEATURE_SHAPE) = 1
    inner join [LegislativeMapData2014].[dbo].[SENATE_2014] D
    on A.FEATURE_SHAPE.STIntersects(D.FEATURE_SHAPE) = 1
    Is there anything I can do to improve the performance of the query? Do I need to hint the indexes? Or something else?
    Thanks

    Hi,
    updating millions of records could lock your resource and other users may have trouble connecting or reading data.
    In some cases, variable table is your friend, insert the data you needed to a variable table before issuing the update.
    with that, you may need to have (nolock) on each table. eg. 
    [LegislativeMapData2014].[dbo].[CONGRESS_2014] (nolock)
    Regards,
    gioVhan
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Spatial query w/ logical operators in a subquery on Linux using Oracle 1

    Hello...
    I'm being given XML that I need to parse and create SQL from it. Below my signature is the SQL that I generate (its a simple example) and can be more elaborate due to the logical operators (AND and OR) given in the XML.
    The problem that we're seeing is performance-based: when one of the logical operator queries is Spatial-based, like below. Running it in JDBC, the query never returns.
    The spatial query just by itself returns ~300 rows (takes approximately 0.2 seconds). The "PERCENTAGE" query by itself returns about ~40000 rows (takes approximately ~.8 seconds).
    If we run the query below with 2 non-spatial subqueries, the result returns and performance is very acceptable (~ 0.9 seconds)-- the result set is about 80000 rows.
    Thanks,
    Jim
    =========================
    SELECT
    COLUMN_WE_WANT , RESULTS
    FROM
    TABLE_A
    WHERE
    COLUMN_WE_WANT IN
    SELECT
    COLUMN_WE_WANT
    FROM
    TABLE_A
    WHERE
    SDO_OVERLAPBDYINTERSECT(TABLE_A.MY_SPATIAL_COLUMN,
    SDO_GEOMETRY(2003,
    4326,
    null,
    SDO_elem_info_array( 1 , 3 , 1 ),
    SDO_ORDINATE_ARRAY( lng_1,lat_1 , lng_2,lat_2 , lng_3,lat_3 , lng_4,lat_4 , lng_1,lat_1 )
    ) = 'TRUE'
    OR
    COLUMN_WE_WANT IN
    SELECT
    COLUMN_WE_WANT
    FROM
    TABLE_B
    WHERE
    SOME_PERCENTAGE_RATE_COLUMN < 90
    )

    Its difficult to comment without seeing the execution plan. You should trace this query to get a better idea of exactly what's happening.
    Depending on the complexity of the logical operators, I would look at doing this using set operations. So for an OR you might have...
    SELECT COLUMN_WE_WANT, RESULTS
    FROM TABLE_A
    WHERE COLUMN_WE_WANT IN (
         SELECT COLUMN_WE_WANT
         FROM TABLE_A
         WHERE SDO_OVERLAPBDYINTERSECT(TABLE_A.MY_SPATIAL_COLUMN,SDO_GEOMETRY(2003,4326,
         NULL, SDO_elem_info_array( 1 , 3 , 1 ),
         SDO_ORDINATE_ARRAY( lng_1,lat_1 , lng_2,lat_2 , lng_3,lat_3 , lng_4,lat_4 , lng_1,lat_1 ) )) = 'TRUE'
    UNION
         SELECT COLUMN_WE_WANT
         FROM TABLE_B
         WHERE SOME_PERCENTAGE_RATE_COLUMN < 90)For an AND, you would use INTERSECT.
    Edited by: Reggie to remove the extra INTERSECT

  • Spatial query w/ logical operators in a subquery on Linux using Oracle 10g

    Hello...
    I'm being given XML that I need to parse and create SQL from it. Below my signature is the SQL that I generate (its a simple example) and can be more elaborate due to the logical operators (AND and OR) given in the XML.
    The problem that we're seeing is performance-based: when one of the logical operator queries is Spatial-based, like below. Running it in JDBC, the query never returns.
    The spatial query just by itself returns ~300 rows (takes approximately 0.2 seconds). The "PERCENTAGE" query by itself returns about ~40000 rows (takes approximately ~.8 seconds).
    If we run the query below with 2 non-spatial subqueries, the result returns and performance is very acceptable (~ 0.9 seconds)-- the result set is about 80000 rows.
    Thanks,
    Jim
    =========================
    SELECT
    COLUMN_WE_WANT , RESULTS
    FROM
    TABLE_A
    WHERE
    COLUMN_WE_WANT IN
    SELECT
    COLUMN_WE_WANT
    FROM
    TABLE_A
    WHERE
    SDO_OVERLAPBDYINTERSECT(TABLE_A.MY_SPATIAL_COLUMN,
    SDO_GEOMETRY(2003,
    4326,
    null,
    SDO_elem_info_array( 1 , 3 , 1 ),
    SDO_ORDINATE_ARRAY( lng_1,lat_1 , lng_2,lat_2 , lng_3,lat_3 , lng_4,lat_4 , lng_1,lat_1 ) )
    ) = 'TRUE'
    OR
    COLUMN_WE_WANT IN
    SELECT
    COLUMN_WE_WANT
    FROM
    TABLE_B
    WHERE
    SOME_PERCENTAGE_RATE_COLUMN < 90
    )

    There is a spatial forum. You will likely have a far better experience there.

  • SSRS - SQL Server Spatial Query

    Hi, I was hoping someone could help me.
    I'm creating an SSRS report with Map and importing points via SQL Server Spatial query. I have a db table with 8,000 points bu the import only ever brings in the first 2,000 queried (no matter what the filter is). Is there a limitation in SSRS that can be
    changed via a configuration setting?
    Many thanks in advance for any help on this,
    Steve.

    Really appreciate you coming back so quick Olaf.
    No its a straightforward query (select AccountNum, Name, Address, Longitude, Lattitude, UrbanArea, County, MI_STYLE, MI_PRINX, SP_GEOMETRY from <table>)
    Just to give the whole picture. I had 8,000 points in MapInfo version 10. I imported them to SQL Server 2012 via MapInfo Easy Loader.
    The SQL Server spatial points import to SSRS and the Bing overlay map works great (so they import to correct space) but its only a subset of the points that import. I can pick any subset using the WHERE clause but I cannot get all 8,000 points.  
    I was hoping there was a configuration setting somewhere in SSRS that was causing the problem.

  • Spatial query in a distributed environment

    We want to compare two spatial tables.
    We have (at present identical) tables on two computers GEOSRV0 and NB25.
    On both we have Oracle 10.1.0.2. GEOSRV0 has the WINDOWS 2000 operating system installed, on NB25 there is WINDOWS XP Professional.
    The table is EZG:
    GEOMETRY MDSYS.SDO_GEOMETRY
    GEOMETRY_SK VARCHAR2(15)
    EZG_NR NOT NULL NUMBER
    FLAECHE FLOAT(126)
    The primary key is EZG_NR.
    There is a private database link for the user WLKREP on NB25 to user WLKREP on GEOSRV0.
    The USER_SDO_GEOM_METADATA are the same on both machines (same SRID, same DIMINFO).
    The following query – we check, if for each record on NB25 is a record on GEOSRV0 - works normally:
    SQL> select ezg_nr from
    2 ezg a where not exists
    3 (select 1 from wlkrep.ezg@wlk where ezg_nr=a.ezg_nr);
    no rows selected
    This is correct.
    We can read the geometry on the remote database:
    SQL> select * from wlkrep.ezg@wlk where rownum=1;
    GEOMETRY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    GEOMETRY_SK EZG_NR FLAECHE
    SDO_GEOMETRY(3003, 1040001, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(182285.489, 405672.889, 0, 182248.701, 405644.889, 0, 182241.984, 405639.771, 0, 182171.753, 405538.805, 0, 182130.953, 405498.016, 0, 181971.1, 405274.91
    6, 0, 182223.796, 405176.609, 0, 182292.701, 405204.37, 0, 182439.028, 405451.66
    , 0, 182573.506, 405628.153, 0, 182643.64, 405726.59, 0, 182718.945, 405764.608,
    0, 182780.371, 405805.57, 0, 182862.191, 405843.931, 0, 182966.69, 405933.13, 0
    , 183131.065, 406064.852, 0, 183205.098, 406160.637, 0, 183231.535, 406220.959,
    0, 183266.473, 406265.415, 0, 183308.669, 406303.524, 0, 183295.305, 406364.696,
    0, 183204.283, 406331.35, 0, 183161.835, 406299.691, 0, 183134.554, 406243.403,
    GEOMETRY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    GEOMETRY_SK EZG_NR FLAECHE
    0, 183080.454, 406171.548, 0, 183027.376, 406123.698, 0, 182914.558, 406039.291
    , 0, 182770.335, 405973.138, 0, 182593.691, 405886.413, 0, 182443.506, 405795.85
    2, 0, 182343.293, 405713.991, 0, 182285.489, 405672.889, 0))
    13 304906.065
    Now we want to compare the geometry and get
    SQL> select a.ezg_nr from
    2 wlkrep.ezg@wlk b, ezg a where a.ezg_nr=b.ezg_nr and
    3 sdo_equal(a.geometry,b.geometry) != 'TRUE';
    select a.ezg_nr from
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    Only comparing two elements gives the same result
    SQL> select a.ezg_nr from
    2 wlkrep.ezg@wlk b, ezg a where a.ezg_nr=640 and
    3 b.ezg_nr = 640 and
    4 sdo_equal(a.geometry,b.geometry) = 'TRUE';
    select a.ezg_nr from
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    Even if we query a non existing element
    select count(*) from ezg where ezg_nr=99999;
    COUNT(*)
    0
    SQL> select a.ezg_nr from
    2 wlkrep.ezg@wlk b, ezg a where a.ezg_nr=99999 and
    3 b.ezg_nr = 99999 and
    4 sdo_equal(a.geometry,b.geometry) = 'TRUE';
    select a.ezg_nr from
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    Is this a bug or is a distributed spatial query not supported?
    The following statement works:
    SQL> select a.ezg_nr from
    2 wlkrep.ezg@wlk a where not exists
    3 (select 1 from ezg b where
    4 b.ezg_nr=a.ezg_nr and
    5 sdo_equal(b.geometry,a.geometry)='TRUE');
    no rows selected
    Regards
    Karl

    Actually, I have filed a TAR to Oracle on this. I also spoke to Steve Muench about it at OracleWorld, briefly. As of today, I'm trying to add to DataScroller.java to make it implement java.io.Serializable (with no luck...maybe someone can comment on what I'm doing wrong).
    Here's what I have done so far.
    Changed DataScroller.java (located in bc4jhtmlsrc.zip) to the following:
    public class DataScroller implements java.io.Serializable
    I added the following members per the docs on java.io.Serializable
    private void writeObject(java.io.ObjectOutputStream out)
    throws IOException
    // really don't need to save state. Next call will recompute what's necessary
    private void readObject(java.io.ObjectInputStream in)
    throws IOException, ClassNotFoundException
    // really don't need to load state. Next call will recompute what's necessary
    I then used jar xvf to "unjar" datatags.jar, replaced DataScroller.class with my version and used
    jar cv0Mf datatags.jar META-INF/* oracle/*
    to recreate the datatags.jar. My file is not 100% the exact same as their file, but it looks to be right to me. I ended up doing it this way because the oracle\ord\* classes are not in the bc4jhtmlsrc.zip, only in the jar file and felt this was the "safest" way to include the correct contents of the file.
    HOWEVER -- I'm sorry to say that I've then tried to run my app and get the same issue.
    Thanks,
    Jeff

  • Spatial Query with multiple geometries from 2 tables

    Hi,
    I'm using Oracle 8.1.7. I am trying to do a spatial query on two tables with multiple geometries. There are two spatial tables. One made up of points and one made up of polygons. There are 829551 rows in the table of points and 1817795 rows in the table with polygons...
    I want to find all polygons where one of this points is within it...
    This query is pretty intensive querying two large spatial tables against each other and so I need to find the most efficient way of running this query. I've been running variations of my query for the last two week and every time it's bombed out with various errors after 12-24 hrs processing like out of memory, out of tablespace, out of processing, invalid index etc etc etc. I need to get this query run asap... Any tips would be gratefully appreciated..
    For the session running the query I've allocated 16M sort area with
    ALTER SESSION SET SORT_AREA_SIZE=16777216;
    Below is the query I'm running... How can I improve this please? BTW PARCEL_OVERLAPS contains the points and TP$_PARCEL_AREAS the polygons.
    SELECT lu.LNU_PARCEL_ID
         FROM
              seventy.PARCEL_OVERLAPS po,
              imap_topol.TP$_PARCEL_AREAS pa,
              TP$_PARCEL_CENTROID_AREA pca,
              TDCR_LAND_UNIT lu
         WHERE
              SDO_FILTER(po.geometry, pa.area,
              'querytype=WINDOW') = ’TRUE’ and
              sdo_within_distance(po.geometry,pa.area,'distance=0')='TRUE' and
              pa.delete_date is null and
              Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
              pa.AREA_ID = pca.AREA_ID and
              pca.DELETE_DATE IS NULL and
              pa.DELETE_DATE IS NULL;

    Albert,
    Thanks for your reply and the tips you've given. The tp$_parcel_areas table will always be bigger so I've changed the order to sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE'. The requested counts for those queries are
    12:26:29 [email protected]:SQL> select count(*)
    13:46:22 2 from seventy.PARCEL_OVERLAPS;
    COUNT(*)
    612
    13:48:12 [email protected]:SQL> select count(*)
    13:48:17 2 from imap_topol.TP$_PARCEL_AREAS pa,
    13:48:21 3 TP$_PARCEL_CENTROID_AREA pca
    13:48:21 4 where pca.DELETE_DATE IS NULL
    13:48:21 5 and pa.DELETE_DATE IS NULL
    13:48:21 6 and pa.AREA_ID = pca.AREA_ID;
    COUNT(*)
    1310665
    There was no reason for both filter and within_distance. I did try use the anyinteract but for some reason that does not return the desired results(I've added one id row as a test to make sure it returns desired results). Plus Oracle have recomended using the within distance for better performance..
    so the explan plan for
    14:38:37 [email protected]:SQL> EXPLAIN PLAN FOR
    14:38:50 2 SELECT lu.LNU_PARCEL_ID
    14:38:50 3 FROM
    14:38:50 4 seventy.PARCEL_OVERLAPS po,
    14:38:50 5 imap_topol.TP$_PARCEL_AREAS pa,
    14:38:50 6 TP$_PARCEL_CENTROID_AREA pca,
    14:38:50 7 TDCR_LAND_UNIT lu
    14:38:50 8 WHERE
    14:38:50 9 sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE' and
    14:38:50 10 pa.delete_date is null and
    14:38:50 11 Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
    14:38:50 12 pa.AREA_ID = pca.AREA_ID and
    14:38:50 13 pca.DELETE_DATE IS NULL and
    14:38:50 14 pa.DELETE_DATE IS NULL;
    is
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 4G|32920G| 547M| | |
    | NESTED LOOPS | | 4G|32920G| 547M| | |
    | MERGE JOIN | | 547M| 2029G| 230124 | | |
    | SORT JOIN | | 1M| 36M| 85014 | | |
    | MERGE JOIN | | 1M| 36M| 50019 | | |
    | SORT JOIN | | 1M| 17M| 21650 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 1M| 17M| 485 | | |
    | SORT JOIN | | 1M| 22M| 28369 | | |
    | TABLE ACCESS FULL |TDCR_LAND | 1M| 22M| 2127 | | |
    | SORT JOIN | | 42K| 160M| 145111 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 42K| 160M| 12697 | | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    14:43:14 [email protected]:SQL> explain plan for
    14:43:23 2 SELECT pa.AREA_ID
    14:43:23 3 FROM seventy.PARCEL_OVERLAPS po,
    14:43:23 4 imap_topol.TP$_PARCEL_AREAS pa
    14:43:23 5 WHERE SDO_RELATE(po.geometry, pa.area,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
    14:43:23 6 and pa.DELETE_DATE IS NULL;
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 6M| 50G| 10M| | |
    | NESTED LOOPS | | 6M| 50G| 10M| | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
    14:45:03 [email protected]:SQL> explain plan for
    14:45:04 2 SELECT pa.AREA_ID
    14:45:05 3 FROM seventy.PARCEL_OVERLAPS po,
    14:45:05 4 imap_topol.TP$_PARCEL_AREAS pa
    14:45:05 5 WHERE SDO_RELATE(pa.area, po.geometry,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
    14:45:05 6 and pa.DELETE_DATE IS NULL;
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 6M| 50G| 863554 | | |
    | NESTED LOOPS | | 6M| 50G| 863554 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    --------------------------------------------------------------------------------

  • Export with embedded spatial query

    I am trying to use the exp utility to export spatial data. I am using the "query" parameter to specify a spatial query based on another spatial layer.
    I have two layers. Admin1 has lots of administrative boundaries. PE has three polygons in it over different sections of my data set. I want to get the data extracted from admin1 that exists in these areas to an export file(along with all the triggers and other related database objects). I was hoping this approach would work
    I am getting errors saying that the identifier is too long.
    Here is the par file:
    file=1.exp
    log=1.log
    tables=(admin1, pe)
    query="""WHERE mdsys.SDO_RELATE(GEOM1,pe.GEOM, 'MASK=INSIDE QUERYTYPE=WINDOW')='TRUE' OR SDO_RELATE(GEOM2,pe.GEOM, 'MASK=INSIDE QUERYTYPE=WINDOW')='TRUE'"""
    I get:
    Export: Release 10.2.0.1.0 - Production on Wed May 10 11:56:14 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Produc
    tion
    With the Partitioning, OLAP and Data Mining options
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    About to export specified tables via Conventional Path ...
    . . exporting table ADMIN1
    EXP-00056: ORACLE error 972 encountered
    ORA-00972: identifier is too long
    . . exporting table PE
    EXP-00056: ORACLE error 972 encountered
    ORA-00972: identifier is too long
    Export terminated successfully with warnings.
    Is this even possible? Can you use the exp query parameter to perform a spatial operation? Did this work? I am accustom to seeing record counts next to the exported tables, and they are not present in the output from exp. The export file is not empty. It exported all the features, not the subset I had requested.
    How can I structure the query differently so that I get the export file with just the lines that fall within the polygons?
    Thanks,
    John

    I am trying to use the exp utility to export spatial data. I am using the "query" parameter to specify a spatial query based on another spatial layer.
    I have two layers. Admin1 has lots of administrative boundaries. PE has three polygons in it over different sections of my data set. I want to get the data extracted from admin1 that exists in these areas to an export file(along with all the triggers and other related database objects). I was hoping this approach would work
    I am getting errors saying that the identifier is too long.
    Here is the par file:
    file=1.exp
    log=1.log
    tables=(admin1, pe)
    query="""WHERE mdsys.SDO_RELATE(GEOM1,pe.GEOM, 'MASK=INSIDE QUERYTYPE=WINDOW')='TRUE' OR SDO_RELATE(GEOM2,pe.GEOM, 'MASK=INSIDE QUERYTYPE=WINDOW')='TRUE'"""
    I get:
    Export: Release 10.2.0.1.0 - Production on Wed May 10 11:56:14 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Produc
    tion
    With the Partitioning, OLAP and Data Mining options
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    About to export specified tables via Conventional Path ...
    . . exporting table ADMIN1
    EXP-00056: ORACLE error 972 encountered
    ORA-00972: identifier is too long
    . . exporting table PE
    EXP-00056: ORACLE error 972 encountered
    ORA-00972: identifier is too long
    Export terminated successfully with warnings.
    Is this even possible? Can you use the exp query parameter to perform a spatial operation? Did this work? I am accustom to seeing record counts next to the exported tables, and they are not present in the output from exp. The export file is not empty. It exported all the features, not the subset I had requested.
    How can I structure the query differently so that I get the export file with just the lines that fall within the polygons?
    Thanks,
    John

  • Poor performance with Oracle Spatial when spatial query invoked remotely

    Is anyone aware of any problems with Oracle Spatial (10.2.0.4 with patches 6989483 and 7003151 on Red Hat Linux 4) which might explain why a spatial query (SDO_WITHIN_DISTANCE) would perform 20 times worse when it was invoked remotely from another computer (using SQLplus) vs. invoking the very same query from the database server itself (also using SQLplus)?
    Does Oracle Spatial have any known problems with servers which use SAN disk storage? That is the primary difference between a server in which I see this poor performance and another server where the performance is fine.
    Thank you in advance for any thoughts you might share.

    OK, that's clearer.
    Are you sure it is the SQL inside the procedure that is causing the problem? To check, try extracting the SQL from inside the procedure and run it in SQLPLUS with
    set autotrace on
    set timing on
    SELECT ....If the plans and performance are the same then it may be something inside the procedure itself.
    Have you profiled the procedure? Here is an example of how to do it:
    Prompt Firstly, create PL/SQL profiler table
    @$ORACLE_HOME/rdbms/admin/proftab.sql
    Prompt Secondly, use the profiler to gather stats on execution characteristics
    DECLARE
      l_run_num PLS_INTEGER := 1;
      l_max_num PLS_INTEGER := 1;
      v_geom    mdsys.sdo_geometry := mdsys.sdo_geometry(2002,null,null,sdo_elem_info_array(1,2,1),sdo_ordinate_array(0,0,45,45,90,0,135,45,180,0,180,-45,45,-45,0,0));
    BEGIN
      dbms_output.put_line('Start Profiler Result = ' || DBMS_PROFILER.START_PROFILER(run_comment => 'PARALLEL PROFILE'));  -- The comment name can be anything: here it is related to the Parallel procedure I am testing.
      v_geom := Parallel(v_geom,10,0.05,1);  -- Put your procedure call here
      dbms_output.put_line('Stop Profiler Result = ' || DBMS_PROFILER.STOP_PROFILER );
    END;
    SHOW ERRORS
    Prompt Finally, report activity
    COLUMN runid FORMAT 99999
    COLUMN run_comment FORMAT A40
    SELECT runid || ',' || run_date || ',' || run_comment || ',' || run_total_time
      FROM plsql_profiler_runs
      ORDER BY runid;
    COLUMN runid       FORMAT 99999
    COLUMN unit_number FORMAT 99999
    COLUMN unit_type   FORMAT A20
    COLUMN unit_owner  FORMAT A20
    COLUMN text        FORMAT A100
    compute sum label 'Total_Time' of total_time on runid
    break on runid skip 1
    set linesize 200
    SELECT u.runid || ',' ||
           u.unit_name,
           d.line#,
           d.total_occur,
           d.total_time,
           text
    FROM   plsql_profiler_units u
           JOIN plsql_profiler_data d ON u.runid = d.runid
                                         AND
                                         u.unit_number = d.unit_number
           JOIN all_source als ON ( als.owner = 'CODESYS'
                                   AND als.type = u.unit_type
                                   AND als.name = u.unit_name
                                AND als.line = d.line# )
    WHERE  u.runid = (SELECT max(runid) FROM plsql_profiler_runs)
    ORDER BY d.total_time desc;Run the profiler in both environments and see if you can see where the slowdown exists.
    regards
    Simon

  • Oracle 9i 10g slow spatial query

    I have been using the following spatial query in oracle 9i to assign jurisdictions to spatial points.
    SELECT /*+ordered*/ L.TCH_X_COORD, L.TCH_Y_COORD, T.NAME
    FROM tis.tis_coordinates_hold_on L,
    geospatial.mdt_admin_districts T
    WHERE SDO_RELATE(T.GEOMETRY,
    MDSYS.SDO_GEOMETRY(2001,41079,MDSYS.SDO_POINT_TYPE(tch_x_coord,tch_y_coord,NULL),
    NULL,NULL),'mask=ANYINTERACT querytype=WINDOW') = 'TRUE'
    AND tch_assigned_base_rte='M00001N'
    By using the ordered hint I was able to double the retrieval rate.  My problem is this: We are now migrating to oracle 10g, and the use of the ordered returns no rows (different incorrect results). If I remove the + ordered the results are correct, but I no longer get the increased speed of retrieval. Has anyone run into this problem, and can you suggest a way that I could speed up this query. As it stands now it takes more than 1/2 sec for each record retrieved, and I have millions of records !! Thanks.

    We're using 10.2.4.0 I believe I have found the reason the queries were different. When I dropped the spatial index and re-created it, the query returned the same rows as 9i. However, I still have an issue with the speed. 10g appears to be about 1/3 as fast as 9i was. It doesn't seem to make any difference whether I put in the +ordered or not.  Our dba says just based on cpu and processing speed the server that has 10g should be significantly faster.  Any comments?  Thanks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Spatial query on join view in another schema

    Background:
    I have a schema with tables containing four spatial columns per table. I have a second schema that contains join views of the tables in the first schema. The join view consists of the attributes and any other tabular data that is joined via foreign key to non-spatial tables and one of the four geometry columns. I have a third schema that owns no database objects of its own, but has select privilege to the second schema's view objects.
    We are using Oracle 10.2.0.2 on a windows platform.
    This worked in 9i, the problem only presented itself when we migrated to 10g.
    Problem:
    When I run a spatial query on a join view in the second schema(the schema that owns the object), it runs and returns results in about a second. When I run the exact same query in the third schema it routinely takes 20-30 seconds.
    Here is the query that I run in both schemas with varying query times:
    SELECT COUNT(*)
    FROM two.join_view_a A
    WHERE (MDSYS.SDO_FILTER(A.GEOM, SDO_GEOMETRY(2003,8307,NULL,SDO_ELEM_INFO_ARRAY(1,1003,3),SDO_ORDINATE_ARRAY(26.6396,26.5708,43.346,34.4083)),'QUERYTYPE=WINDOW')='TRUE');
    Question:
    Why does this happen?
    What can I do to fix this problem?
    Thanks,
    John

    Have a read of this posting: Oracle spatial view runing slow as different user
    There are details there about the 'optimizer_secure_view_merging' parameter and the effect it can have on cross schema views in 10.2

  • Index problem in a spatial query

    I try to run following query in SQL Plus:
    SELECT A.objectid FROM TABBDG A, TABREG B
    WHERE A.objectid = 68 AND B.regionname = 'Hong2'
    AND SDO_RELATE(A.geoloc, B.geoloc, 'mask=INSIDE querytype = WINDOW') = 'TRUE';
    To find out weather or not objectid = 68 is inside of region (='Hong2"). I got following error messages:
    ERROR at line 1:
    ORA-13226: interface not supported without a spatial index
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 8
    ORA-06512: at "MDSYS.SDO_3GL", line 57
    ORA-06512: at line 1
    But when I try to add an index to table TABREG, I got following error:
    ERROR at line 1:
    ORA-29879: cannot create multiple domain indexes on a column list using same indextype
    Seem to me that the index was already there. Can any one help me? Thanks.

    I found out the reason of problem. I used an old version of EasyLoader (4.5?). When I get the latest EasyLoader V6.5, there is no problem any more to run spatial query. You can get lates EasyLoader V6.5 from MapInfo or from me at: [email protected]
    Thanks for all help.

  • Spatial query optimizing

    hi, there.
    I am working Oracle Spatial 9.0.1 and I have a problem about the
    performance of spaital query, can someone help me resolve it?
    /*query 1*/
    select t1.line_seg
    from spatial_list_Traj
    where sdo_within_distance(convert_trajseg_to_lineseg
    (t1.line_seg), MDSYS.SDO_GEOMETRY(2003, NULL, NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 3), MDSYS.SDO_ORDINATE_ARRAY
    (212.117, 352.613, 221.617, 362.708)), 'querytype=filter
    distance=0.5') = 'TRUE';
    /* query 2*/
    select t1.line_seg
    from spatial_list_traj
    where object_id = 1 and sdo_within_distance
    (convert_trajseg_to_lineseg(t1.line_seg), MDSYS.SDO_GEOMETRY
    (2003, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 3),
    MDSYS.SDO_ORDINATE_ARRAY(212.117, 352.613, 221.617,
    362.708)), 'querytype=filter distance=0.5') = 'TRUE';
    there are about 120,000 rows in the spatial_list_Traj table and
    query 1 takes only 1 second to finish, which is a good result
    but if I add another condition, like query 2, the time cost is
    still 1 second. I thought it can be much faster since there is
    only 48 rows whose object_id is 1. what I expected it to do was
    for the optimizer to filter out the rows that match
    the 'object_id = 1' criteria and then do a spatial query on the
    filtered data.
    PS: there are two indices--a b-tree index on column 'object_id'
    and of course, a functional spatial index on column 'line_seg',
    which is a R-tree.
    thanks in advance
    Hu Cao

    Hi Hu,
    The second query is probably not using the spatial index. The
    spatial index indexes the whole table based on spatial
    relationships, so even though you may have filtered out all but
    48 rows, the spatial index has to be applied to all of the rows.
    In this case, it is probable that all of the rows returned with
    object_id=1 are being geometrically compared with your query
    window, which may account for the extra time.
    You may want to try a hint to tell the optimizer not to use the
    index on object_id, i.e.
    SELECT /*+NO_INDEX(spatial_list_traj object_id_index_name)*/
    Hope this helps,
    dan

  • Spatial Query across schemas. one version enabled table another not -Hanged

    Hi,
    I am executing a PL/sql procedure where a Spatial query run across two schemas. One table(in x schema) is version enabled and second table(in y schema) is Unversioned. Add to that complexity I am running the procedure from third user logon. I think I have enough previleges, as I won't get any error message.
    But, Procedure worked fine when there is no table is version enabled. It started giving problem when one table got version enabled.
    I have tried by setting " DBMS_WM.Gotoworkspace('LIVE');" before running spatial query. But still no luck, process just hangs on the spatial query.
    I tried by using physical name of the Table (table1_LT) which is making it to work. But, as per Workspace manager guide, applications, programs should NOT use, this physical tables(because it is not the correct way on versioned table).
    1. How can I hint to my query, to use a table from only live version?
    2. Why Query is hanging forever (even tried by leaving it over night....)
    Normally it used to take one or two minutes(before versioning..)
    I have posted it Workspace manager forum, But No Luck (people seems to be shy away after seeing "Spatial query" )
    Any help is highly appriciated

    Hi,
    I will need to know more details about the specific query you are performing. So, please do the following:
    1. list the actual query that you are using
    2. generate an explain plan of the query both before and after the table was version enabled. use @?/rdbms/admin/utlxpls or anything that generates the predicate information.
    3. also, give any pertinent details about the table(size of the table, number of rows expected to be returned, column types in the table, etc).
    Based on that, I will see if I can suggest a possible hint that may be able to improve the performance of your query.
    Regards,
    Ben

Maybe you are looking for

  • KIMYONG: AP Invoice Distributions  에서  Track As Asset 사용법

    Purpose Invioc 등록시 asset 계정이 아닌 expense 계정도 FA로 넘기기 위해서는 track as asset을 사용합니다. 이에대한 설명을 하고자 합니다. Solution The Navigation Path 는 아래와 같습니다. Payables>Invoices>Entry>Invoices Press Distributions button Track as Asset을 check하는 것은 아래 의미를 가지고 있씁니다. Checkbo

  • Tomcat 5.5 & jsp

    hi i am using tomcat 5.5 form my jsp, but when i use tomcat 4, it did not show me any error but when i use tomcat 5.0, it show mr this error: javax.servlet.ServletException: [Microsoft][ODBC Driver Manager] Data source name not found and no default d

  • Vivienne Tam wireless Mouse does not work.

    My wife's Vivienne Tam wireless Mouse for HP Mini 210-1032VU does not work anymore, but the light at the scroll wheel keep flashing/flickering. We tried changing the battery, but that did not help. Any suggestions what the problem might be?  The mous

  • Accessing CRM Interaction center outside network

    Hi, I have a basic question for better understanding. We have CRM ISA and CRM Interaction center. Our customers are able to log in to the Online Ordering website through Internet. But the URL for CRM Interaction center is not working, if I try to log

  • ADRC table Duplicates

    Hi, I am seeing two different address numbers for the same BP and the Name1, Name2 etc details are getting displayed for one of the address numbers and the other address number is coming as blank. Can anyone please tell me the reason for this and how