Why Oracle Spatial Query So Slow???

I have 90,000 lines in my database. When I did a query about
finding all the lines within a certain distance of a point, it
took me nearly 30 seconds. And when I query the intersection
between the lines, it took me about 5 minutes!! God, I can't
believe it!
Do you guys met the problem before? Please share something with
me, thank you so much!
Xiong

Hi,
Are you using a spatial index for your within distance query? If
so, what kind, and have you tuned it at all?
As far as the intersection question goes, how many geometries are
you testing? Are they big? Are you only comparing the ones
returned by within distance?
If they are big geometries, there are some very large performance
gains in 9i when dealing with larger geometries.
Dan

Similar Messages

  • Why oracle spatial query execute so slow???

    hi all,
    I have two oracle spatial table CHI_2007r2 and CHI_2008r2, each table has it's own spatial index,and each table has 2000 row record, Now execute this query,I can get the result soon,
    select /*+ ORDERED */ a.link_id from chi_2007r2 a,chi_2008r2 b where a.link_id=b.link_id and sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE';
    But I execute the query by geom only,it will take so long time! query(3 more hours):
    select /*+ ORDERED */ a.link_id,b.link_id from chi_2007r2 a,chi_2008r2 b where sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE';
    I don't upderstand...
    thanks
    David

    Because in the first statement
    select /*+ ORDERED */ a.link_id from chi_2007r2 a,chi_2008r2 b where a.link_id=b.link_id and sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE'; you are joining the two tables while in the second statement
    select /*+ ORDERED */ a.link_id,b.link_id from chi_2007r2 a,chi_2008r2 b where sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE';you are doing a cartesian merge first because there is no join between a and b other than te sdo_relate which will be calculated for every row combination you get.
    But I think you'd be better off posting in the {forum:id=76} forum.
    Best regards,
    PP
    Edited by: porzer on Jan 15, 2009 10:34 AM

  • Why is the query so slow?

    Hi,
    I've got a query running fast (3 sec.)
    If I try to execute it on test enviroment, it takes about 2 minutes (!)
    I see in both enviroments the explain plan is the same and so are the indexes used. I've also tried to rebuild the indexes and the tables that looked quite fragmented in test, but the result is always the same. Could it be that our test enviroment is slower and with lower performances? What else could I check? (Oracle Vers. is 8.1.7)
    Thanks!

    812809 wrote:
    steps to follow:
    1.whether the candidate columns has index or notSometimes and index can cause a query to slow down rather than speed up, especially if a person has created too many indexes on a table and the optimiser can't figure out the best one to use.
    2.go for explain plan and look the query not to fall under the category of Full Table ScanFull table scans are not always a bad thing. Sometimes they are faster than using the index. It depends.

  • Oracle spatial query with php

    Hello, I have this problem,
    I use php for read data from oracle table,
    all works right, I have any problem whith varchar number type data, but when I must read geometry data like
    (type MDSYS.SDO_GEOMETRY)
    I can't display it on the web page.
    esemple of spatial query that I use:
    select GEOMETRY_1
    from table_a
    where
    ID = 970;
    If I use sql plus I have this result
    SDO_GEOMETRY(3001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(1, -0, -
    0, 580094, 4998494, -1))
    but blank page when I use php sentence.
    I use PHP Version 4.4.0
    modules load are:
    extension=php_sdo.dll
    extension=php_oci8.dll
    But I don't know which other module I need and also which php function to use for read array of array. at the moment I use @OCIFetchInto.
    Someone can help me?
    My English is very bad please reply easy.
    Thanks for all!
    Angelo

    Thank you very much CJ.
    Now there isn't any problems: you and this link (Re: PHP and spatial data and Adamo Bozzetti helped me
    I have used SDO_UTIL.GETVERTICES
    my complete php script is:
    $conn = @OCILogon("xxxxxx", "xxxxx", "xxxxx") or die
    ( "Non riesco a connettermi al server $host ");
    $query = "select
    TABLE_A.tipo_via,
    TABLE_A.nome_via,
    c.codice_via,
    t.X,
    t.Y
    from TABLE B c, TABLE_A , TABLE(SDO_UTIL.GETVERTICES(c.geometry1)) t
    where c.codice_via = 830
    and c.codice_via = TABLE_A.id_via
    $istruzione = @OCIParse($conn, $query);
    @OCIExecute($istruzione);
    $nrows = @OCIFetchInto($istruzione, $results);
    $trovati = 0;
    while(@OCIFetchInto($istruzione, $results))
    $trovati++;
    ?>     
    <table border width="800" >
    <tr>     
    <td align="center" width="80" bgcolor ="#aaffee"><?echo trim($results[0]);?></td>
    <td align="center" width="150" bgcolor ="#eeffee"><?echo trim($results[1]);?></td>
    <td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[2]);?></td>
    <td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[3]);?></td>
    <td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[4]);?></td>
    </tr>
    </table>
    <?
    } //fine While
    @OCIFreeStatement($istruzione);
    @OCILogOff($conn);

  • Oracle spatial query SDO_LRS with php

    Hello, I have this problem,
    I use php for read data from oracle table.
    I know I can't show on web page the result of SDO_ORDINATE_ARRAY
    Christopher Jones has written that I must use SDO_UTIL.GETVERTICES like as
    select
    t.X,
    t.Y
    from table_a, TABLE(SDO_UTIL.GETVERTICES(table_a.GEOMETRY_1)) t
    where
    id_num = 970;
    But now I must read a projection point ordinate of a point with respect to a geometric segment
    and the same problem come back.
    esemple of spatial query that I use:
    SELECT
    SDO_LRS.PROJECT_PT(geometry,
    SDO_GEOMETRY(3301, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(580094.69, 4998493.68, NULL)) )
    FROM
    TABLE_B
    WHERE
    ID_CODE = 970;
    If I use sql plus I have this result
    SDO_LRS.PROJECT_PT(GEOMETRY,SD(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM
    SDO_GEOMETRY(3301, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(
    580093,325, 4998497,57, 45,2254405))
    Which is exacly the query for extract these coordinates?
    Someone can help me?
    My English is very bad please reply easy.
    Thanks for all!
    Angelo

    Hello thanks for all to everyboby.
    I put the same question on Forum /Category/Database/Spatial and I have received this reply
    from Brian Camire, this query worked well.
    SELECT
    T.X,
    T.Y
    FROM
    TABLE
    SELECT
    SDO_UTIL.GETVERTICES
    SDO_LRS.PROJECT_PT
    GEOMETRY,
    SDO_GEOMETRY
    3301,
    NULL,
    NULL,
    SDO_ELEM_INFO_ARRAY(1, 1, 1),
    SDO_ORDINATE_ARRAY(580093.859, 4998493.5, NULL)
    FROM
    TABLE_B
    WHERE
    ID_CODE = 970
    ) T;
    Best regards
    Angelo.

  • Very basic question Oracle spatial query

    Hi All,
    Iam a newbie to oracle spatial.
    How can i verify that oracle spatial is installed in my database.
    My database is version is 10.2.0.2.0
    Is there any special query i can execute to test oracle spatial is working properly / installed properly.
    All the finctionality oracle spatial is working properly
    Thanks in advance.
    baskar k

    Spatial     VALID     10.2.0.2.0
    I got this message on executing this query
    +++++++++++++++++++++++++++++++
    SELECT comp_name, status, substr(version,1,10) as version
    from dba_server_registry
    where comp_name = 'Spatial';
    ++++++++++++++++++++++++++++++++

  • Oracle Spatial Query from SQLPLUS deteriorates in performance

    Hi,
    I am running an sql-procedure, which does spatial queries. When I run this procedure (from SQLPLUS) for the first time it takes around 45 sec to complete, but when I run the same procedure for the second time it takes 65 seconds and the performance keeps on decreasing. But if I open a new SQLPLUS session it takes 45 secs and it also starts deteriorating subsequently. This strange behaviour is only for spatial queries, if I don't have spatial queries in my procedure then its fine.
    I found this behaviour for any type of spatial query.
    Is there something which can be done for improving it ? I found a lot of information on improving performance of a query, but my problem is to maintain the same performance of the same query in the same session.
    Thanks,
    Rishi

    Hi,
    Could you provide version information?
    Also, could you try monitoring memory as the procedure is running an see
    if memory climbs more each time the procedure is run?
    Thanks

  • Spatial query runs slow on view

    Hello,
    I have two tables and one of them has geometry column. I created view to join those two tables based on id column which has been indexed for both tables.
    t1(
    id number(9),
    name varchar2(20)
    t2(
    id number(9),
    geom MDSYS.SDO_GEOMETRY
    CREATE VIEW v1 (
    id,
    name,
    geom
    ) AS
    SELECT /*+ FIRST_ROWS */ t1.id, t1.name, t2.geom
    FROM t1,t2
    WHERE t1.id = t2.id
    When I query the view with following statement it runs very slow (there are more then 1 million rows in t2 table)
    SELECT * FROM v1
    WHERE mdsys.sdo_filter(geom, [a rectangle],'querytype=window') = 'TRUE';
    but
    SELECT /*+ FIRST_ROWS */ t1.id, t1.name,t2.geom
    FROM t1,t2
    WHERE t1.id=t2.id
    and mdsys.sdo_filter(geom, [a rectangle],'querytype=window') = 'TRUE';
    returns almost instantly. Can some one tell me what is wrong with the "create view" statement?
    Thanks

    Thank you for your reply. Here are the plans. The view looks for the spatial index first.
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 21 | 756 | 10 (60)|
    | 1 | NESTED LOOPS | | 21 | 756 | 10 (60)|
    | 2 | TABLE ACCESS BY INDEX ROWID| T2 | 5269 | 123K| 3 (0)|
    | 3 | DOMAIN INDEX | T2_SDX | | | |
    | 4 | TABLE ACCESS BY INDEX ROWID| T1 | | | |
    | 5 | INDEX RANGE SCAN | T1_ID_IDX | 1 | | 0 (0)|
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 21 | 756 | 99 (3)|
    | 1 | TABLE ACCESS BY INDEX ROWID | T2 | 1 | 24 | 99 (3)|
    | 2 | NESTED LOOPS | | 21 | 756 | 99 (3)|
    | 3 | TABLE ACCESS FULL | T1 | 21 | 252 | 2 (0)|
    | 4 | BITMAP CONVERSION TO ROWIDS | | | | |
    | 5 | BITMAP AND | | | | |
    | 6 | BITMAP CONVERSION FROM ROWIDS| | | | |
    | 7 | INDEX RANGE SCAN | T2_ID_IDX | 1 | | 2 (0)|
    | 8 | BITMAP CONVERSION FROM ROWIDS| | | | |
    | 9 | SORT ORDER BY | | | | |
    | 10 | DOMAIN INDEX | T2_SDX | 1 | | |
    -----------------------------------------------------------------------------------------------------

  • SPATIAL QUERY VERY SLOW

    I CAN TO EXECUTE THIS QUERY BUT IT IS VERY SLOW, I HAVE 2 TABLE , ONE A WITH 250.000 SITE AND B WITH 250.000 POINTS, I WANT TO DETERMINING HOW MANY RISK INSIDE THE SITES.
    THANKS
    JGS
    SELECT B.ID, A.ID, A.GC, A.SUMA
    FROM DBG_RIESGOS_CUMULOS_SITE A, DBG_RIESGOS_CUMULOS B
    WHERE A.GC = 'PATRIMONIAL FENOMENOS SISMICOS' AND A.GC=B.GC
    AND SDO_RELATE(B.GEOMETRY, A.GEOMETRY, 'MASK=INSIDE') = 'TRUE';
    100 RECORS IN 220 '' SLOWWWWW

    I would do two things:
    1) Ensure Oracle is patched with the latest 10.2.0.4 patches
    This is the list I've been working with:
    Patch 7003151
    Patch 6989483
    Patch 7237687
    Patch 7276032
    Patch 7307918
    2) Write the query like this
    SELECT /*+ ORDERED*/ B.ID, A.ID, A.GC, A.SUMA
    FROM DBG_RIESGOS_CUMULOS B, DBG_RIESGOS_CUMULOS_SITE A
    WHERE B.GC = 'PATRIMONIAL FENOMENOS SISMICOS'
    AND A.GC=B.GC
    AND SDO_ANYINTERACT(A.GEOMETRY, B.GEOMETRY) = 'TRUE';

  • How to execute Oracle Spatial Query

    I'd like to return a set of SDO_GEOMETRY columns of MDSYS.SDO_GEOM.SDO_BUFFER(geom, dim, distance) Spatial Function by MDSYS.SDO_WITHIN_DISTANCE(T.column,aGeom,params) Spatial Operator.
    Does anyone have experience doing this? Is there a better way to return an SDO_GEOMETRY column of MDSYS.SDO_GEOM.SDO_BUFFER(geom, dim, distance) Spatial Function.
    Assume I have a table "my_table" defined as
    STANUMBER VARCHAR2(5)
    STANAME VARCHAR2(18)
    TYPE NUMBER(2)
    LAYER NUMBER
    STAPROVINCE VARCHAR2(6)
    STACOUNTY VARCHAR2(23)
    STALATITUDE NUMBER
    STALONGITUDE NUMBER
    STANUMBER_2 VARCHAR2(5)
    STANAME_2 VARCHAR2(18)
    TYPE_2 NUMBER(2)
    LAYER_2 NUMBER
    STAPROVINCE_2 VARCHAR2(6)
    STACOUNTY_2 VARCHAR2(23)
    GEOLOC MDSYS.SDO_GEOMETRY
    --use the MDSYS.SDO_GEOM.SDO_BUFFER(geom, dim, distance) Spatial Function.
    select MDSYS.SDO_GEOM.SDO_BUFFER(geoloc,
    (select diminfo from user_sdo_geom_metadata m where
    m.table_name='STA_QZT1' and m.column_name='GEOLOC'),10)
    FROM STA_QZT1 a WHERE a.STANUMBER=12345;
    --The right result as follwing:
    MDSYS.SDO_GEOM.SDO_BUFFER(GEOLOC,(SELECTDIMINFOFROMUSER_SDO_GEOM_METADATAMWHEREM
    SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1005, 6, 1, 2, 2, 5, 2, 1,
    7, 2, 2, 11, 2, 1, 13, 2, 2, 17, 2, 1), SDO_ORDINATE_ARRAY(83.171677, 57.508809
    4, 72.4970097, 48.2324159, 81.7734032, 37.5577486, 82.6298628, 37.4977234, 94.05
    59481, 34.5268537, 100.350233, 44.5150204, 100.130743, 47.6855154, 97.2287, 54.0
    629335, 90.853757, 56.9704094, 83.171677, 57.5088094))
    --use the MDSYS.SDO_WITHIN_DISTANCE(T.column,aGeom,params) Spatial Operator.
    select s.stanumber from sta_qzt1 s where
    MDSYS.SDO_WITHIN_DISTANCE(s.geoloc,MDSYS.SDO_GEOMETRY(2003, 8192, NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1), MDSYS.SDO_ORDINATE_ARRAY(125.923454,
    57.457314, 121.5189, 51.845055, 126.989075, 48.506115, 133.38278, 55.04191,
    125.923454, 57.457314)),'distance = 0' )= 'TRUE';
    --The right result as follwing:
    STANU
    11110
    However, joint to use the above function to execute a buffer query(cannot work) at PL/SQL:
    select s.stanumber from sta_qzt1 s where
    (select mdsys.sdo_geom.sdo_buffer(geoloc,
    (select diminfo from user_sdo_geom_metadata m where m.table_name='STA_QZT1'
    and m.column_name='GEOLOC'),10)
    FROM STA_QZT1 a WHERE a.STANUMBER=12345),
    'distance = 0' )= 'TRUE';
    PL/SQL give out the error information as following:
    ERROR at line 5:
    ORA-00936: lack of expression
    null

    Jack,
    This should work:
    select MDSYS.SDO_GEOM.SDO_BUFFER(geoloc,
    (select diminfo from user_sdo_geom_metadata m where
    m.table_name='STA_QZT1' and m.column_name='GEOLOC'),10)
    from sta_qzt1 s where MDSYS.SDO_WITHIN_DISTANCE(s.geoloc,
    MDSYS.SDO_GEOMETRY(2003, 8192, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1), MDSYS.SDO_ORDINATE_ARRAY(125.923454,
    57.457314, 121.5189, 51.845055, 126.989075, 48.506115, 133.38278, 55.04191, 125.923454, 57.457314)),
    'distance = 0' )= 'TRUE';

  • Oracle Spatial Query

    I have created two tables the first called pai_equal created from the query below
    create table pai_equal as
    (select /*+ ORDERED */ l.*, t.toid
    from sub_lt l, sub_topoarea t
    where mdsys.sdo_relate(t.geoloc, l.geoloc,
    'mask=EQUAL querytype=WINDOW')='TRUE');
    This returns 4 rows which is correct
    This query selects the terrier polygons that are made up of one topo_area polygon only (and no more and align exactly)
    The second table is called inside_coveredby created as follows
    create table inside_coveredby as
    select /*+ ORDERED */ l.*, t.toid
    from sub_lt l, sub_topoarea t
    where mdsys.sdo_relate(t.geoloc, l.geoloc,
    'mask=INSIDE+COVEREDBY querytype=WINDOW')='TRUE'
    order by l.mi_prinx;
    Returns 1142 undistinct rows, 475(distinct)
    This query selects terrier polygons that are
    (a) made up or two or more topo area polygons and where the boundaries align exactly
    (b) made up of one or more topo area polygons and where the boundaries do not align exactly
    What I want to do next is select all the terriers that are not included in either of the above 2 queries. Totals should now add up to 754 (4 +475+ ?)as the original terrier table contains 754 features
    I think I need to select from sub_lt where mi_prinx is not in inside+coveredby or the equal table?
    Has anyone any ideas on how to write this?
    Your help as usual is much appreciated

    You can use SQL difference operator to do this:
    select toid from sub_lt
    MINUS
    select /*+ ORDERED */ l.*, t.toid
    from sub_lt l, sub_topoarea t
    where mdsys.sdo_relate(t.geoloc, l.geoloc,
    'mask=INSIDE+COVEREDBY querytype=WINDOW')='TRUE'
    order by l.mi_prinx;
    This should give you everything other than inside+coveredby.
    If you want to include the equal also,
    change the mask to inside+coveredby+equal.

  • Why does this query run slow ??

    hi ,
    i have the following query
    SELECT
      PT.PT_ID,
      PCD_INST.CALL_PCD_NAME,
      RC.RC_ID,
      RC.RC_TITLE,
      PCD.PCD_TITLE,
      RC.E_TYPE
    FROM
      PT,
      PCD_INST,
      RC,
      PCD,
      PCD_INST_RS
    WHERE
      ( PT.PT_ID = PCD_INST.PCD_ID  )
      AND  ( PCD.PCD_ID = PCD_INST_RS.PCD_ID  )
      AND  ( (RC.RC_NAME = PCD_INST_RS.RC_NAME) AND (RC.RC_ACTIVE_FLAG = 'A')  )
      AND  ( (PCD.PCD_ID LIKE PCD_INST.CALL_PCD_NAME || '.%') AND (PCD.PCD_AFLAG = 'A')  )
      AND  (
      ( PT.PT_AFLAG = 'A'  )
      AND  ( PT.OBS_FLAG <> 'Y'  )
      AND  ( PCD.PCD_AFLAG = 'A'  )
      AND  ( PCD.OBS_FLAG <> 'Y'  )
      AND  ( RC.RC_AFLAG = 'A'  )
      AND  ( RC.OBS_FLAG <> 'Y'  )
      AND   TO_NUMBER (PCD_INST.INST_NUM)  =  123
      AND  ( PCD_INST_RS.H = 'Y'  )
      AND  ( PCD_INST_RS.MP = 'Y'  )
      AND  PT.PSTATUS  =  'A')and the execution plan
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=228 Card=1 Bytes=205
       1    0   TABLE ACCESS (BY INDEX ROWID) OF 'PCD_INST' (Cost=
              2 Card=136 Bytes=4352)
       2    1     NESTED LOOPS (Cost=228 Card=1 Bytes=205)
       3    2       MERGE JOIN (CARTESIAN) (Cost=227 Card=3 Bytes=519)
       4    3         TABLE ACCESS (BY INDEX ROWID) OF 'PCD_INST_RS'
                     (Cost=4 Card=1 Bytes=41)
       5    4           NESTED LOOPS (Cost=141 Card=1 Bytes=143)
       6    5             MERGE JOIN (CARTESIAN) (Cost=57 Card=28 Bytes=28
              56)
       7    6               TABLE ACCESS (BY INDEX ROWID) OF 'RC' (Cos
              t=2 Card=1 Bytes=52)
       8    7                 INDEX (RANGE SCAN) OF 'RC_IDX1' (NON
              -UNIQUE) (Cost=1 Card=1)
       9    6               BUFFER (SORT) (Cost=55 Card=65 Bytes=3250)
      10    9                 TABLE ACCESS (BY INDEX ROWID) OF 'PCD' (Cos
              t=56 Card=65 Bytes=3250)
      11   10                   INDEX (RANGE SCAN) OF 'PCD_IDX_1' (NON
              -UNIQUE) (Cost=30 Card=25944)
      12    5             INDEX (RANGE SCAN) OF 'PCD_INST_RS
              _PK' (UNIQUE) (Cost=3 Card=233)
      13    3         BUFFER (SORT) (Cost=223 Card=165 Bytes=4950)
      14   13           TABLE ACCESS (FULL) OF 'PART' (Cost=86 Card=165 By
              tes=4950)
      15    2       INDEX (RANGE SCAN) OF 'PCD_INST_PK' (UNIQUE) (
              Cost=2 Card=1)what would you suggest so the performance can be much better ?
    or anything that i shld take note from the execution plan ?
    current it took > 4 hrs to retrieve abt 300 - 400k records
    tks & rdgs

    Probably all the additional brackets in the where
    clause.
    Just kidding, but it would help to see what is
    happening better if you got rid of them, e.g.
    WHERE
    ( PT.PT_ID = PCD_INST.PCD_ID  )
    AND  ( PCD.PCD_ID = PCD_INST_RS.PCD_ID  )Should be
    WHERE
    PT.PT_ID = PCD_INST.PCD_ID 
    AND   PCD.PCD_ID = PCD_INST_RS.PCD_ID  You could remove the to_number
    AND   PCD_INST.INST_NUM  =  '123'
    anything that i shld take note from the executionplan ?
    What is shld?
    retrieve abt 300 - 400k recordsHow many is abt?
    SELECT STATEMENT Optimizer=CHOOSE (Cost=228Card=1 Bytes=205)Optimizer thinks it is going to return 1 row so your
    statistics are way off.
    What is rdgs?hi ,
    i'll first remove the bracket and the to_number and try
    then
    i'll check with the DBA to see if the stats are up to date
    sorry for the short-form, i was reminded earlier not to use that but i forgot
    shld --> should
    rdgs --> regards

  • 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

  • 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

  • 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for