Spatial Join

Hi,
I am new to Oracle Spatial.
I am having two different version of TeleAtlas road network data. I am not seeing any common id between these two map data. I would like to copy two columns from old data to the new data based on geometry.
any help on this.

If you are trying to add two new columns from the old table to the new table, you might have to do some kind of join on these two tables.
One way to do this is to come up with a mapping table from new IDs to old IDs.
This can be done by joining the geometry with sdo_equal operator (11.2 19 Spatial Operator in http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11830/sdo_operat.htm) or if you have other unique keys (like name, most likely will be more efficient than spatial join).
Once the mapping table is created, you can update the new table with two columns from the old table with your old table and the mapping table:
Since you have a fairly large table (~30M rows) with indexes, a better/efficient approach is to create a new table instead of updating the current new table.
Then rename it and create necessary indexes on it.
jack

Similar Messages

  • Spatial join view

    Good afternoon,
    I am new on oracle spatial and I have to do a simple spatial join view. So from two table name and a operation I have to create a view that makes a join of type "operation" between two table.
    For example, in a high level language:
    create or replace view VIEW_NAME as select * from table1,table2 where operation(table1.geom,table2.geom).
    Where "operation" could be intersect, touch, overlaps,contains, disjoint...and so on...
    I can't find a complete example for my problem.
    Thanks for all your help, it is very important.
    Best regards
    Anna Zanetti

    ok..thank you very much.
    But If I want to make one of the following operation (BBOX,Beyond,Contains,Crosses,Disjoint,
    Equals,Intersects,Overlaps,Touches,Within), what kind of mask have I to use?
    I understand that this are the possibile mask:
    TOUCH, OVERLAPBDYDISJOINT, OVERLAPBDYINTERSECT, EQUAL, INSIDE, COVEREDBY, CONTAINS, COVERS, ANYINTERACT, ON
    I think that there is not a perfect matching, in fact I think that ANYINTERACT is different from intersects!!!
    I am wrong?
    Is there any table of matching between operations???
    Thank a lot
    Best regards
    Anna Zanetti

  • Significant performance change in spatial join

    Hi,
    I have 2 spatial tables in Oracle 10g: one (PT_SOURCE) has a point column with over a half million records and another (TRJ_TMP_BUF) has a polygon column with 2 records. 2 spatial R-tree indexes were built on the 2 table respectively. I tried a spatial join to see how many points fall into one polygon. The SQL statement is:
    SELECT a.id, d.name FROM pt_source a, trj_tmp_buf b, TABLE (SDO_JOIN('PT_SOURCE', 'SHAPE', 'TRJ_TMP_BUF', 'SHAPE', 'mask=ANYINTERACT')) c, pollution_source d WHERE c.rowid1 = a.rowid AND c.rowid2 = b.rowid and d.id=a.id
    The first a couple of run of the query took about 2 and a half hours to complete. 2 days after I tried the same query again. It only took about 2 minutes to complete! I'm pretty sure that the workload of the server was in the same level as in the first run. I'm wondering if there is something going on with the spatial indexes that may cause such significant improvement.
    BTW, I imported the same data set into another server that is configured similarly and runs another instance of Oracle 10g. All the spatial indexes were built. This time the same query took about 2 hours to complete. Does any body have any explanation about this? Thanks in advance.

    Hi, Dan,
    I'm sorry that I made a mistake in the file names. The second trace file is for the database that is faster.
    I set a less file size for the second trace file. That might be why its space was limited. I ran the query again and set the file size to 5 MB (the same as for the first trace file). The newly generated trace file for the faster database is as following:
    TKPROF: Release 10.1.0.3.0 - Production on Tue May 10 22:50:51 2005
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Trace file: airpltn_ora_19874_gis23Test2.trc
    Sort options: default
    count = number of times OCI procedure was executed
    cpu = cpu time in seconds executing
    elapsed = elapsed time in seconds executing
    disk = number of physical reads of buffers from disk
    query = number of buffers gotten for consistent read
    current = number of buffers gotten in current mode (usually for update)
    rows = number of rows processed by the fetch or execute call
    alter session set sql_trace=true
    call count cpu elapsed disk query current rows
    Parse 0 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 0 0.00 0.00 0 0 0 0
    total 1 0.00 0.00 0 0 0 0
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV)
    select t.ts#,t.file#,t.block#,nvl(t.bobj#,0),nvl(t.tab#,0),t.intcols,
    nvl(t.clucols,0),t.audit$,t.flags,t.pctfree$,t.pctused$,t.initrans,
    t.maxtrans,t.rowcnt,t.blkcnt,t.empcnt,t.avgspc,t.chncnt,t.avgrln,
    t.analyzetime,t.samplesize,t.cols,t.property,nvl(t.degree,1),
    nvl(t.instances,1),t.avgspc_flb,t.flbcnt,t.kernelcols,nvl(t.trigflag, 0),
    nvl(t.spare1,0),nvl(t.spare2,0),t.spare4,t.spare6,ts.cachedblk,ts.cachehit,
    ts.logicalread
    from
    tab$ t, tab_stats$ ts where t.obj#= :1 and t.obj# = ts.obj# (+)
    call count cpu elapsed disk query current rows
    Parse 10 0.00 0.00 0 0 0 0
    Execute 20 0.01 0.00 0 0 0 0
    Fetch 20 0.02 0.00 0 82 0 20
    total 50 0.03 0.01 0 82 0 20
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    3 NESTED LOOPS OUTER (cr=12 pr=0 pw=0 time=1001 us)
    3 TABLE ACCESS CLUSTER OBJ#(4) (cr=9 pr=0 pw=0 time=728 us)
    3 INDEX UNIQUE SCAN OBJ#(3) (cr=6 pr=0 pw=0 time=334 us)(object id 3)
    0 TABLE ACCESS BY INDEX ROWID OBJ#(671) (cr=3 pr=0 pw=0 time=198 us)
    0 INDEX RANGE SCAN OBJ#(672) (cr=3 pr=0 pw=0 time=160 us)(object id 672)
    select i.obj#,i.ts#,i.file#,i.block#,i.intcols,i.type#,i.flags,i.property,
    i.pctfree$,i.initrans,i.maxtrans,i.blevel,i.leafcnt,i.distkey,i.lblkkey,
    i.dblkkey,i.clufac,i.cols,i.analyzetime,i.samplesize,i.dataobj#,
    nvl(i.degree,1),nvl(i.instances,1),i.rowcnt,mod(i.pctthres$,256),
    i.indmethod#,i.trunccnt,nvl(c.unicols,0),nvl(c.deferrable#+c.valid#,0),
    nvl(i.spare1,i.intcols),i.spare4,i.spare2,i.spare6,decode(i.pctthres$,null,
    null,mod(trunc(i.pctthres$/256),256)),ist.cachedblk,ist.cachehit,
    ist.logicalread
    from
    ind$ i, ind_stats$ ist, (select enabled, min(cols) unicols,
    min(to_number(bitand(defer,1))) deferrable#,min(to_number(bitand(defer,4)))
    valid# from cdef$ where obj#=:1 and enabled > 1 group by enabled) c where
    i.obj#=c.enabled(+) and i.obj# = ist.obj#(+) and i.bo#=:1
    call count cpu elapsed disk query current rows
    Parse 10 0.00 0.00 0 0 0 0
    Execute 23 0.01 0.00 0 0 0 0
    Fetch 58 0.04 0.03 0 189 0 35
    total 91 0.05 0.04 0 189 0 35
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    7 HASH JOIN OUTER (cr=30 pr=0 pw=0 time=5363 us)
    7 NESTED LOOPS OUTER (cr=21 pr=0 pw=0 time=1211 us)
    7 TABLE ACCESS CLUSTER OBJ#(19) (cr=16 pr=0 pw=0 time=834 us)
    3 INDEX UNIQUE SCAN OBJ#(3) (cr=6 pr=0 pw=0 time=302 us)(object id 3)
    0 TABLE ACCESS BY INDEX ROWID OBJ#(673) (cr=5 pr=0 pw=0 time=252 us)
    0 INDEX UNIQUE SCAN OBJ#(674) (cr=5 pr=0 pw=0 time=170 us)(object id 674)
    1 VIEW (cr=9 pr=0 pw=0 time=1563 us)
    1 SORT GROUP BY (cr=9 pr=0 pw=0 time=1522 us)
    1 TABLE ACCESS CLUSTER OBJ#(31) (cr=9 pr=0 pw=0 time=775 us)
    3 INDEX UNIQUE SCAN OBJ#(30) (cr=6 pr=0 pw=0 time=339 us)(object id 30)
    select name,intcol#,segcol#,type#,length,nvl(precision#,0),decode(type#,2,
    nvl(scale,-127/*MAXSB1MINAL*/),178,scale,179,scale,180,scale,181,scale,182,
    scale,183,scale,231,scale,0),null$,fixedstorage,nvl(deflength,0),default$,
    rowid,col#,property, nvl(charsetid,0),nvl(charsetform,0),spare1,spare2,
    nvl(spare3,0)
    from
    col$ where obj#=:1 order by intcol#
    call count cpu elapsed disk query current rows
    Parse 13 0.00 0.00 0 0 0 0
    Execute 30 0.01 0.00 0 0 0 0
    Fetch 432 0.01 0.02 0 93 0 402
    total 475 0.02 0.03 0 93 0 402
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    25 SORT ORDER BY (cr=9 pr=0 pw=0 time=1334 us)
    25 TABLE ACCESS CLUSTER OBJ#(21) (cr=9 pr=0 pw=0 time=704 us)
    3 INDEX UNIQUE SCAN OBJ#(3) (cr=6 pr=0 pw=0 time=283 us)(object id 3)
    select type#,blocks,extents,minexts,maxexts,extsize,extpct,user#,iniexts,
    NVL(lists,65535),NVL(groups,65535),cachehint,hwmincr, NVL(spare1,0),
    NVL(scanhint,0)
    from
    seg$ where ts#=:1 and file#=:2 and block#=:3
    call count cpu elapsed disk query current rows
    Parse 8 0.00 0.00 0 0 0 0
    Execute 8 0.00 0.00 0 0 0 0
    Fetch 8 0.00 0.00 0 24 0 8
    total 24 0.00 0.00 0 24 0 8
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    0 TABLE ACCESS CLUSTER SEG$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (cr=0 pr=0 pw=0 time=0 us)(object id 9)
    select owner#,name,namespace,remoteowner,linkname,p_timestamp,p_obj#,
    nvl(property,0),subname,d_attrs
    from
    dependency$ d, obj$ o where d_obj#=:1 and p_obj#=obj#(+) order by order#
    call count cpu elapsed disk query current rows
    Parse 42 0.00 0.01 0 0 0 0
    Execute 42 0.01 0.01 0 0 0 0
    Fetch 197 0.06 0.02 0 487 0 155
    total 281 0.07 0.05 0 487 0 155
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    4 SORT ORDER BY (cr=13 pr=0 pw=0 time=806 us)
    4 NESTED LOOPS OUTER (cr=13 pr=0 pw=0 time=729 us)
    4 TABLE ACCESS BY INDEX ROWID DEPENDENCY$ (cr=3 pr=0 pw=0 time=267 us)
    4 INDEX RANGE SCAN I_DEPENDENCY1 (cr=2 pr=0 pw=0 time=160 us)(object id 120)
    4 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=10 pr=0 pw=0 time=313 us)
    4 INDEX UNIQUE SCAN I_OBJ1 (cr=6 pr=0 pw=0 time=171 us)(object id 36)
    select order#,columns,types
    from
    access$ where d_obj#=:1
    call count cpu elapsed disk query current rows
    Parse 42 0.00 0.01 0 0 0 0
    Execute 42 0.02 0.00 0 0 0 0
    Fetch 123 0.03 0.00 0 246 0 81
    total 207 0.05 0.02 0 246 0 81
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    3 TABLE ACCESS BY INDEX ROWID ACCESS$ (cr=8 pr=0 pw=0 time=220 us)
    3 INDEX RANGE SCAN I_ACCESS1 (cr=5 pr=0 pw=0 time=232 us)(object id 122)
    select col#, grantee#, privilege#,max(mod(nvl(option$,0),2))
    from
    objauth$ where obj#=:1 and col# is not null group by privilege#, col#,
    grantee# order by col#, grantee#
    call count cpu elapsed disk query current rows
    Parse 12 0.00 0.00 0 0 0 0
    Execute 16 0.01 0.00 0 0 0 0
    Fetch 16 0.00 0.00 0 32 0 0
    total 44 0.01 0.00 0 32 0 0
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    0 SORT GROUP BY (cr=2 pr=0 pw=0 time=257 us)
    0 TABLE ACCESS BY INDEX ROWID OBJ#(85) (cr=2 pr=0 pw=0 time=156 us)
    0 INDEX RANGE SCAN OBJ#(102) (cr=2 pr=0 pw=0 time=136 us)(object id 102)
    select grantee#,privilege#,nvl(col#,0),max(mod(nvl(option$,0),2))
    from
    objauth$ where obj#=:1 group by grantee#,privilege#,nvl(col#,0) order by
    grantee#
    call count cpu elapsed disk query current rows
    Parse 12 0.00 0.00 0 0 0 0
    Execute 36 0.01 0.00 0 0 0 0
    Fetch 66 0.02 0.01 0 107 0 30
    total 114 0.03 0.02 0 107 0 30
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    0 SORT GROUP BY (cr=2 pr=0 pw=0 time=213 us)
    0 TABLE ACCESS BY INDEX ROWID OBJ#(85) (cr=2 pr=0 pw=0 time=119 us)
    0 INDEX RANGE SCAN OBJ#(102) (cr=2 pr=0 pw=0 time=102 us)(object id 102)
    select col#,intcol#,toid,version#,packed,intcols,intcol#s,flags, synobj#,
    nvl(typidcol#, 0)
    from
    coltype$ where obj#=:1 order by intcol# desc
    call count cpu elapsed disk query current rows
    Parse 11 0.01 0.01 0 0 0 0
    Execute 14 0.03 0.02 0 0 0 0
    Fetch 32 0.00 0.00 0 45 0 18
    total 57 0.04 0.03 0 45 0 18
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    3 SORT ORDER BY (cr=3 pr=0 pw=0 time=362 us)
    3 TABLE ACCESS CLUSTER OBJ#(281) (cr=3 pr=0 pw=0 time=188 us)
    1 INDEX UNIQUE SCAN OBJ#(3) (cr=2 pr=0 pw=0 time=101 us)(object id 3)
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#,
    sample_size, minimum, maximum, distcnt, lowval, hival, density, col#,
    spare1, spare2, avgcln
    from
    hist_head$ where obj#=:1 and intcol#=:2
    call count cpu elapsed disk query current rows
    Parse 7 0.00 0.00 0 0 0 0
    Execute 99 0.02 0.01 0 0 0 0
    Fetch 99 0.04 0.01 0 291 0 91
    total 205 0.06 0.03 0 291 0 91
    Misses in library cache during parse: 0
    Optimizer mode: RULE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    13 TABLE ACCESS BY INDEX ROWID OBJ#(214) (cr=39 pr=0 pw=0 time=2198 us)
    13 INDEX RANGE SCAN OBJ#(216) (cr=26 pr=0 pw=0 time=1368 us)(object id 216)
    select /*+ rule */ bucket, endpoint, col#, epvalue
    from
    histgrm$ where obj#=:1 and intcol#=:2 and row#=:3 order by bucket
    call count cpu elapsed disk query current rows
    Parse 4 0.00 0.00 0 0 0 0
    Execute 27 0.00 0.00 0 0 0 0
    Fetch 27 0.01 0.01 0 81 0 432
    total 58 0.01 0.01 0 81 0 432
    Misses in library cache during parse: 0
    Optimizer mode: RULE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    161 SORT ORDER BY (cr=30 pr=0 pw=0 time=3997 us)
    161 TABLE ACCESS CLUSTER OBJ#(212) (cr=30 pr=0 pw=0 time=2430 us)
    10 INDEX UNIQUE SCAN OBJ#(211) (cr=20 pr=0 pw=0 time=701 us)(object id 211)
    select intcol#, toid, version#, intcols, intcol#s, flags, synobj#
    from
    subcoltype$ where obj#=:1 order by intcol# asc
    call count cpu elapsed disk query current rows
    Parse 11 0.01 0.00 0 0 0 0
    Execute 14 0.01 0.00 0 0 0 0
    Fetch 14 0.01 0.00 0 45 0 0
    total 39 0.03 0.00 0 45 0 0
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    0 SORT ORDER BY (cr=3 pr=0 pw=0 time=254 us)
    0 TABLE ACCESS CLUSTER OBJ#(284) (cr=3 pr=0 pw=0 time=177 us)
    1 INDEX UNIQUE SCAN OBJ#(3) (cr=2 pr=0 pw=0 time=91 us)(object id 3)
    select col#,intcol#,ntab#
    from
    ntab$ where obj#=:1 order by intcol# asc
    call count cpu elapsed disk query current rows
    Parse 11 0.00 0.00 0 0 0 0
    Execute 14 0.00 0.00 0 0 0 0
    Fetch 14 0.00 0.00 0 14 0 0
    total 39 0.00 0.00 0 14 0 0
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    0 TABLE ACCESS BY INDEX ROWID OBJ#(351) (cr=1 pr=0 pw=0 time=144 us)
    0 INDEX RANGE SCAN OBJ#(353) (cr=1 pr=0 pw=0 time=124 us)(object id 353)
    select l.col#, l.intcol#, l.lobj#, l.ind#, l.ts#, l.file#, l.block#, l.chunk,
    l.pctversion$, l.flags, l.property, l.retention, l.freepools
    from
    lob$ l where l.obj# = :1 order by l.intcol# asc
    call count cpu elapsed disk query current rows
    Parse 14 0.00 0.00 0 0 0 0
    Execute 14 0.00 0.00 0 0 0 0
    Fetch 24 0.00 0.00 0 45 0 10
    total 52 0.00 0.01 0 45 0 10
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    2 SORT ORDER BY (cr=3 pr=0 pw=0 time=318 us)
    2 TABLE ACCESS CLUSTER LOB$ (cr=3 pr=0 pw=0 time=168 us)
    1 INDEX UNIQUE SCAN I_OBJ# (cr=2 pr=0 pw=0 time=95 us)(object id 3)
    select o.owner#,o.name,o.namespace,o.remoteowner,o.linkname,o.subname,
    o.dataobj#,o.flags
    from
    obj$ o where o.obj#=:1
    call count cpu elapsed disk query current rows
    Parse 7 0.00 0.00 0 0 0 0
    Execute 27 0.00 0.00 0 0 0 0
    Fetch 27 0.00 0.00 0 81 0 27
    total 61 0.00 0.01 0 81 0 27
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    2 TABLE ACCESS BY INDEX ROWID OBJ#(18) (cr=6 pr=0 pw=0 time=313 us)
    2 INDEX UNIQUE SCAN OBJ#(36) (cr=4 pr=0 pw=0 time=189 us)(object id 36)
    select col#,intcol#,reftyp,stabid,expctoid
    from
    refcon$ where obj#=:1 order by intcol# asc
    call count cpu elapsed disk query current rows
    Parse 11 0.00 0.00 0 0 0 0
    Execute 14 0.00 0.00 0 0 0 0
    Fetch 14 0.00 0.00 0 14 0 0
    total 39 0.00 0.00 0 14 0 0
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    0 TABLE ACCESS BY INDEX ROWID OBJ#(361) (cr=1 pr=0 pw=0 time=158 us)
    0 INDEX RANGE SCAN OBJ#(363) (cr=1 pr=0 pw=0 time=133 us)(object id 363)
    select col#,intcol#,charsetid,charsetform
    from
    col$ where obj#=:1 order by intcol# asc
    call count cpu elapsed disk query current rows
    Parse 11 0.01 0.00 0 0 0 0
    Execute 14 0.00 0.00 0 0 0 0
    Fetch 372 0.00 0.00 0 45 0 358
    total 397 0.01 0.01 0 45 0 358
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    9 SORT ORDER BY (cr=3 pr=0 pw=0 time=338 us)
    9 TABLE ACCESS CLUSTER OBJ#(21) (cr=3 pr=0 pw=0 time=219 us)
    1 INDEX UNIQUE SCAN OBJ#(3) (cr=2 pr=0 pw=0 time=93 us)(object id 3)
    select intcol#,type,flags,lobcol,objcol,extracol,schemaoid, elemnum
    from
    opqtype$ where obj# = :1 order by intcol# asc
    call count cpu elapsed disk query current rows
    Parse 11 0.00 0.00 0 0 0 0
    Execute 14 0.00 0.00 0 0 0 0
    Fetch 14 0.00 0.00 0 14 0 0
    total 39 0.00 0.00 0 14 0 0
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    0 TABLE ACCESS BY INDEX ROWID OBJ#(364) (cr=1 pr=0 pw=0 time=145 us)
    0 INDEX RANGE SCAN OBJ#(365) (cr=1 pr=0 pw=0 time=127 us)(object id 365)
    select pos#,intcol#,col#,spare1,bo#,spare2
    from
    icol$ where obj#=:1
    call count cpu elapsed disk query current rows
    Parse 11 0.01 0.00 0 0 0 0
    Execute 35 0.00 0.00 0 0 0 0
    Fetch 75 0.00 0.00 0 150 0 40
    total 121 0.01 0.01 0 150 0 40
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    3 TABLE ACCESS BY INDEX ROWID OBJ#(20) (cr=20 pr=0 pw=0 time=942 us)
    3 INDEX RANGE SCAN OBJ#(40) (cr=17 pr=0 pw=0 time=732 us)(object id 40)
    select metadata
    from
    kopm$ where name='DB_FDO'
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.01 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 2 0 1
    total 3 0.01 0.01 0 2 0 1
    Misses in library cache during parse: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID KOPM$ (cr=2 pr=0 pw=0 time=140 us)
    1 INDEX UNIQUE SCAN I_KOPM1 (cr=1 pr=0 pw=0 time=83 us)(object id 350)
    select obj#,type#,ctime,mtime,stime,status,dataobj#,flags,oid$, spare1,
    spare2
    from
    obj$ where owner#=:1 and name=:2 and namespace=:3 and remoteowner is null
    and linkname is null and subname is null
    call count cpu elapsed disk query current rows
    Parse 9 0.00 0.00 0 0 0 0
    Execute 34 0.00 0.00 0 0 0 0
    Fetch 34 0.00 0.00 0 94 0 26
    total 77 0.00 0.01 0 94 0 26
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID OBJ#(18) (cr=5 pr=0 pw=0 time=403 us)
    1 INDEX RANGE SCAN OBJ#(37) (cr=4 pr=0 pw=0 time=293 us)(object id 37)
    select node,owner,name
    from
    syn$ where obj#=:1
    call count cpu elapsed disk query current rows
    Parse 8 0.00 0.00 0 0 0 0
    Execute 10 0.00 0.00 0 0 0 0
    Fetch 10 0.00 0.00 0 30 0 10
    total 28 0.00 0.00 0 30 0 10
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID OBJ#(61) (cr=3 pr=0 pw=0 time=164 us)
    1 INDEX UNIQUE SCAN OBJ#(100) (cr=2 pr=0 pw=0 time=97 us)(object id 100)
    select /*+ index(idl_sb4$ i_idl_sb41) +*/ piece#,length,piece
    from
    idl_sb4$ where obj#=:1 and part=:2 and version=:3 order by piece#
    call count cpu elapsed disk query current rows
    Parse 30 0.00 0.00 0 0 0 0
    Execute 30 0.01 0.00 0 0 0 0
    Fetch 82 0.01 0.00 0 216 0 52
    total 142 0.02 0.02 0 216 0 52
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    2 TABLE ACCESS BY INDEX ROWID IDL_SB4$ (cr=6 pr=0 pw=0 time=226 us)
    2 INDEX RANGE SCAN I_IDL_SB41 (cr=4 pr=0 pw=0 time=181 us)(object id 116)
    select /*+ index(idl_ub1$ i_idl_ub11) +*/ piece#,length,piece
    from
    idl_ub1$ where obj#=:1 and part=:2 and version=:3 order by piece#
    call count cpu elapsed disk query current rows
    Parse 30 0.01 0.00 0 0 0 0
    Execute 30 0.02 0.00 0 0 0 0
    Fetch 58 0.01 0.00 0 149 0 30
    total 118 0.04 0.02 0 149 0 30
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID IDL_UB1$ (cr=4 pr=0 pw=0 time=222 us)
    1 INDEX RANGE SCAN I_IDL_UB11 (cr=3 pr=0 pw=0 time=164 us)(object id 113)
    select /*+ index(idl_char$ i_idl_char1) +*/ piece#,length,piece
    from
    idl_char$ where obj#=:1 and part=:2 and version=:3 order by piece#
    call count cpu elapsed disk query current rows
    Parse 30 0.00 0.00 0 0 0 0
    Execute 30 0.00 0.00 0 0 0 0
    Fetch 55 0.01 0.00 0 135 0 25
    total 115 0.01 0.01 0 135 0 25
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID IDL_CHAR$ (cr=4 pr=0 pw=0 time=233 us)
    1 INDEX RANGE SCAN I_IDL_CHAR1 (cr=3 pr=0 pw=0 time=168 us)(object id 114)
    select /*+ index(idl_ub2$ i_idl_ub21) +*/ piece#,length,piece
    from
    idl_ub2$ where obj#=:1 and part=:2 and version=:3 order by piece#
    call count cpu elapsed disk query current rows
    Parse 30 0.02 0.00 0 0 0 0
    Execute 30 0.02 0.00 0 0 0 0
    Fetch 56 0.00 0.00 0 190 0 51
    total 116 0.04 0.02 0 190 0 51
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    0 TABLE ACCESS BY INDEX ROWID IDL_UB2$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN I_IDL_UB21 (cr=0 pr=0 pw=0 time=0 us)(object id 115)
    select audit$,properties
    from
    type_misc$ where obj#=:1
    call count cpu elapsed disk query current rows
    Parse 16 0.01 0.01 0 0 0 0
    Execute 16 0.01 0.00 0 0 0 0
    Fetch 16 0.00 0.00 0 48 0 16
    total 48 0.02 0.03 0 48 0 16
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    0 TABLE ACCESS CLUSTER TYPE_MISC$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_OBJ# (cr=0 pr=0 pw=0 time=0 us)(object id 3)
    select source
    from
    source$ where obj#=:1 order by line
    call count cpu elapsed disk query current rows
    Parse 4 0.01 0.00 0 0 0 0
    Execute 4 0.02 0.01 0 0 0 0
    Fetch 4 0.00 0.00 0 16 0 30
    total 12 0.03 0.02 0 16 0 30
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    2 TABLE ACCESS BY INDEX ROWID SOURCE$ (cr=4 pr=0 pw=0 time=244 us)
    2 INDEX RANGE SCAN I_SOURCE1 (cr=3 pr=0 pw=0 time=161 us)(object id 112)
    select obj#
    from
    oid$ where user#=:1 and oid$=:2
    call count cpu elapsed disk query current rows
    Parse 2 0.01 0.01 0 0 0 0
    Execute 6 0.02 0.02 0 0 0 0
    Fetch 6 0.00 0.00 0 18 0 6
    total 14 0.03 0.03 0 18 0 6
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID OBJ#(291) (cr=3 pr=0 pw=0 time=165 us)
    1 INDEX UNIQUE SCAN OBJ#(292) (cr=2 pr=0 pw=0 time=105 us)(object id 292)
    select con#,obj#,rcon#,enabled,nvl(defer,0)
    from
    cdef$ where robj#=:1
    call count cpu elapsed disk query current rows
    Parse 6 0.00 0.00 0 0 0 0
    Execute 10 0.00 0.00 0 0 0 0
    Fetch 11 0.01 0.00 0 12 0 1
    total 27 0.01 0.00 0 12 0 1
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    select con#,type#,condlength,intcols,robj#,rcon#,match#,refact,nvl(enabled,0),
    rowid,cols,nvl(defer,0),mtime,nvl(spare1,0)
    from
    cdef$ where obj#=:1
    call count cpu elapsed disk query current rows
    Parse 6 0.00 0.00 0 0 0 0
    Execute 10 0.00 0.00 0 0 0 0
    Fetch 35 0.00 0.00 0 51 0 25
    total 51 0.00 0.00 0 51 0 25
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    select intcol#,nvl(pos#,0),col#,nvl(spare1,0)
    from
    ccol$ where con#=:1
    call count cpu elapsed disk query current rows
    Parse 4 0.00 0.00 0 0 0 0
    Execute 25 0.00 0.00 0 0 0 0
    Fetch 52 0.01 0.00 0 104 0 27
    total 81 0.01 0.00 0 104 0 27
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    select u.name, o.name, a.interface_version#
    from
    association$ a, user$ u, obj$ o where a.obj# = :1
    and a.property = :2
    and a.statstype# = o.obj# and
    u.user# = o.owner#
    call count cpu elapsed disk query current rows
    Parse 6 0.02 0.01 0 0 0 0
    Execute 6 0.02 0.01 0 0 0 0
    Fetch 6 0.00 0.00 0 38 0 4
    total 18 0.04 0.02 0 38 0 4
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Rows Row Source Operation
    0 NESTED LOOPS (cr=3 pr=0 pw=0 time=300 us)
    0 NESTED LOOPS (cr=3 pr=0 pw=0 time=288 us)
    0 TABLE ACCESS FULL ASSOCIATION$ (cr=3 pr=0 pw=0 time=280 us)
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us)(object id 36)
    0 TABLE ACCESS CLUSTER USER$ (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN I_USER# (cr=0 pr=0 pw=0 time=0 us)(object id 11)
    select count(*)
    FROM
    pt_source a, trj_tmp_buf b, TABLE (SDO_JOIN('PT_SOURCE', 'SHAPE',
    'TRJ_TMP_BUF', 'SHAPE', 'mask=ANYINTERACT')) c, pollution_source d WHERE
    c.rowid1 = a.rowid AND c.rowid2 = b.rowid and d.id=a.id
    call count cpu elapsed disk query current rows
    Parse 1 0.25 0.21 0 165 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.25 0.21 0 165 0 0
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: ALL_ROWS
    0 SORT (AGGREGATE)
    0 HASH JOIN
    0 INDEX MODE: ANALYZED (FAST FULL SCAN) OF 'SYS_C005072'
    (INDEX (UNIQUE))
    0 NESTED LOOPS
    0 HASH JOIN
    0 INDEX MODE: ANALYZED (FULL SCAN) OF 'SYS_C005098'
    (INDEX (UNIQUE))
    0 COLLECTION ITERATOR (PICKLER FETCH) OF 'SDO_JOIN'
    0 TABLE ACCESS MODE: ANALYZED (BY USER ROWID) OF
    'PT_SOURCE' (TABLE)
    SELECT USER
    FROM
    DUAL
    call count cpu elapsed disk query current rows
    Parse 2 0.01 0.00 0 0 0 0
    Execute 2 0.00 0.00 0 0 0 0
    Fetch 2 0.00 0.00 0 0 0 2
    total 6 0.01 0.00 0 0 0 2
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV) (recursive depth: 1)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: ALL_ROWS
    0 FAST DUAL
    SELECT INSTR(:B1 , '.')
    FROM
    DUAL
    call count cpu elapsed disk query current rows
    Parse 2 0.02 0.01 0 0 0 0
    Execute 2 0.00 0.00 0 0 0 0
    Fetch 2 0.00 0.00 0 0 0 2
    total 6 0.02 0.01 0 0 0 2
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV) (recursive depth: 1)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: ALL_ROWS
    0 FAST DUAL
    select cols,audit$,textlength,intcols,property,flags,rowid
    from
    view$ where obj#=:1
    call count cpu elapsed disk query current rows
    Parse 7 0.00 0.00 0 0 0 0
    Execute 7 0.00 0.00 0 0 0 0
    Fetch 7 0.00 0.00 0 21 0 7
    total 21 0.00 0.01 0 21 0 7
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID OBJ#(62) (cr=3 pr=0 pw=0 time=168 us)
    1 INDEX UNIQUE SCAN OBJ#(98) (cr=2 pr=0 pw=0 time=106 us)(object id 98)
    select text
    from
    view$ where rowid=:1
    call count cpu elapsed disk query current rows
    Parse 12 0.04 0.01 0 0 0 0
    Execute 12 0.01 0.00 0 0 0 0
    Fetch 12 0.00 0.00 0 24 0 12
    total 36 0.05 0.02 0 24 0 12
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    0 TABLE ACCESS BY USER ROWID VIEW$ (cr=0 pr=0 pw=0 time=0 us)
    SELECT index_owner, index_name
    from
    all_ind_columns WHERE table_name = 'PT_SOURCE' and column_name = 'SHAPE'
    and table_owner = 'APPDEV'
    call count cpu elapsed disk query current rows
    Parse 1 0.17 0.17 0 3 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 43 0 1
    total 3 0.17 0.17 0 46 0 1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV) (recursive depth: 1)
    error during execute of EXPLAIN PLAN statement
    ORA-01039: insufficient privileges on underlying objects of the view
    parse error offset: 100
    SELECT index_owner, index_name
    from
    all_ind_columns WHERE table_name = 'TRJ_TMP_BUF' and column_name = 'SHAPE'
    and table_owner = 'APPDEV'
    call count cpu elapsed disk query current rows
    Parse 1 0.15 0.14 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 38 0 1
    total 3 0.15 0.14 0 38 0 1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV) (recursive depth: 1)
    error during execute of EXPLAIN PLAN statement
    ORA-01039: insufficient privileges on underlying objects of the view
    parse error offset: 100
    SELECT sdo_rtree_height
    from
    all_sdo_index_metadata WHERE sdo_index_name = 'PT_SPATIAL_IDX' and
    sdo_index_owner = 'APPDEV'
    call count cpu elapsed disk query current rows
    Parse 1 0.22 0.19 0 51 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 24 0 1
    total 3 0.22 0.19 0 75 0 1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV) (recursive depth: 1)
    error during execute of EXPLAIN PLAN statement
    ORA-01039: insufficient privileges on underlying objects of the view
    parse error offset: 93
    SELECT sdo_rtree_height
    from
    all_sdo_index_metadata WHERE sdo_index_name = 'TRJ_TMP_BUF_SPT_IDX' and
    sdo_index_owner = 'APPDEV'
    call count cpu elapsed disk query current rows
    Parse 1 0.09 0.08 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 24 0 1
    total 3 0.09 0.08 0 24 0 1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV) (recursive depth: 1)
    error during execute of EXPLAIN PLAN statement
    ORA-01039: insufficient privileges on underlying objects of the view
    parse error offset: 93
    select numbind, nextbindnum, property
    from
    operator$ where obj#=:1
    call count cpu elapsed disk query current rows
    Parse 2 0.01 0.00 0 0 0 0
    Execute 2 0.02 0.01 0 0 0 0
    Fetch 2 0.00 0.00 0 4 0 2
    total 6 0.03 0.02 0 4 0 2
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID OPERATOR$ (cr=2 pr=0 pw=0 time=138 us)
    1 INDEX UNIQUE SCAN OPER1 (cr=1 pr=0 pw=0 time=81 us)(object id 369)
    select bind#, functionname, property, returnschema, returntype, impschema,
    imptype
    from
    opbinding$ where obj# = :1
    call count cpu elapsed disk query current rows
    Parse 2 0.01 0.01 0 21 0 0
    Execute 2 0.03 0.01 0 0 0 0
    Fetch 4 0.00 0.00 0 6 0 2
    total 8 0.04 0.02 0 27 0 2
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID OPBINDING$ (cr=3 pr=0 pw=0 time=198 us)
    1 INDEX RANGE SCAN OPBIND1 (cr=2 pr=0 pw=0 time=196 us)(object id 371)
    select position, type
    from
    oparg$ where obj#=:1 and bind#=:2 order by position
    call count cpu elapsed disk query current rows
    Parse 2 0.01 0.01 0 0 0 0
    Execute 2 0.02 0.01 0 0 0 0
    Fetch 8 0.00 0.00 0 4 0 6
    total 12 0.03 0.03 0 4 0 6
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    3 SORT ORDER BY (cr=2 pr=0 pw=0 time=343 us)
    3 TABLE ACCESS BY INDEX ROWID OPARG$ (cr=2 pr=0 pw=0 time=215 us)
    3 INDEX RANGE SCAN OPARG1 (cr=1 pr=0 pw=0 time=127 us)(object id 375)
    select obj#,implobj#,property, interface_version#
    from
    indtypes$ where obj#=:1
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.00 0 0 0 0
    Execute 1 0.01 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 3 0 1
    total 3 0.02 0.01 0 3 0 1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS FULL OBJ#(376) (cr=3 pr=0 pw=0 time=242 us)
    select obj#,oper#,bind#,property,filt_nam,filt_sch, filt_typ
    from
    indop$ where obj#=:1
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 49 0.00 0.00 0 51 0 48
    total 51 0.00 0.01 0 51 0 48
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    48 TABLE ACCESS FULL OBJ#(377) (cr=51 pr=0 pw=0 time=239 us)
    declare
    rstr varchar2(4000);
    begin
    :1 := "MDSYS"."SDO_INDEX_METHOD_10I".ODCIINDEXREWRITE(SYS.ODCIINDEXINFO('APPDEV', 'TRJ_TMP_BUF_SPT_IDX',
    SYS.ODCICOLINFOLIST(SYS.ODCICOLINFO('APPDEV', 'TRJ_TMP_BUF', '"SHAPE"', 'SDO_GEOMETRY', 'MDSYS', NULL)),
    NULL, 0, 0),
    SYS.ODCIINDEXINFO('APPDEV', 'PT_SPATIAL_IDX',
    SYS.ODCICOLINFOLIST(SYS.ODCICOLINFO('APPDEV', 'PT_SOURCE', '"SHAPE"', 'SDO_GEOMETRY', 'MDSYS', NULL)),
    NULL, 0, 0),
    'B', 'A', SYS.ODCIPREDINFO('MDSYS', 'SDO_RELATE', NULL, 13), SYS.ODCIQUERYINFO(2, NULL),
    'TRUE', 'TRUE', 'querytype=window mask=ANYINTERACT', rstr, SYS.ODCIENV(0, 0, 0, 24));
    :2 := rstr;
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.00 0 0 0 0
    Execute 1 0.14 0.18 0 360 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.15 0.19 0 360 0 1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 36 (MDSYS) (recursive depth: 2)
    select audit$
    from
    library$ where obj#=:1
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.00 0 0 0 0
    Execute 1 0.02 0.01 0 0 0 0
    Fetch 1 0.00 0.00 0 3 0 1
    total 3 0.03 0.02 0 3 0 1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 3)
    Rows Row Source Operation
    1 TABLE ACCESS CLUSTER LIBRARY$ (cr=3 pr=0 pw=0 time=202 us)
    1 INDEX UNIQUE SCAN I_OBJ# (cr=2 pr=0 pw=0 time=73 us)(object id 3)
    SELECT sdo_diminfo, nvl(sdo_srid,-1)
    FROM
    SDO_GEOM_METADATA_TABLE WHERE SDO_OWNER = 'APPDEV' AND SDO_TABLE_NAME =
    UPPER('TRJ_TMP_BUF') AND '"'||SDO_COLUMN_NAME||'"' = '"SHAPE"'
    call count cpu elapsed disk query current rows
    Parse 1 0.04 0.05 0 6 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 2 0 1
    total 3 0.04 0.05 0 8 0 1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 36 (MDSYS) (recursive depth: 3)
    Rows Row Source Operation
    0 TABLE ACCESS BY INDEX ROWID SDO_GEOM_METADATA_TABLE (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN SDO_GEOM_IDX (cr=0 pr=0 pw=0 time=0 us)(object id 41168)
    error during execute of EXPLAIN PLAN statement
    ORA-00942: table or view does not exist
    parse error offset: 107
    SELECT sdo_diminfo, nvl(sdo_srid,-1)
    FROM
    SDO_GEOM_METADATA_TABLE WHERE SDO_OWNER = 'APPDEV' AND SDO_TABLE_NAME =
    UPPER('PT_SOURCE') AND '"'||SDO_COLUMN_NAME||'"' = '"SHAPE"'
    call count cpu elapsed disk query current rows
    Parse 1 0.03 0.03 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 2 0 1
    total 3 0.03 0.03 0 2 0 1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 36 (MDSYS) (recursive depth: 3)
    Rows Row Source Operation
    0 TABLE ACCESS BY INDEX ROWID SDO_GEOM_METADATA_TABLE (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX RANGE SCAN SDO_GEOM_IDX (cr=0 pr=0 pw=0 time=0 us)(object id 41168)
    error during execute of EXPLAIN PLAN statement
    ORA-00942: table or view does not exist
    parse error offset: 107
    SELECT nvl(sdo_level,0), nvl(sdo_numtiles,0), nvl(sdo_maxlevel, 0),
    sdo_index_table, sdo_index_primary, sdo_index_type, nvl(sdo_rtree_height, 0)
    , nvl(sdo_rtree_num_nodes, 0), nvl(sdo_rtree_dimensionality, 0),
    nvl(sdo_rtree_fanout, 0), nvl(sdo_rtree_root, 'EMPTY'),
    nvl(sdo_rtree_seq_name, 'DEFAULT'), sdo_index_partition,
    nvl(sdo_partitioned, 0), nvl(sdo_layer_gtype, 'DEFAULT'),
    nvl(sdo_index_dims, 0), nvl(sdo_rtree_pctfree, 10), nvl(sdo_rtree_quality,
    0), nvl(sdo_index_version, 0), nvl(sdo_tablespace, 'DEFAULT'),
    nvl(sdo_index_geodetic, 'FALSE'), sdo_index_status
    FROM
    sdo_index_metadata_table WHERE sdo_index_owner = 'APPDEV' and sdo_index_name
    = 'TRJ_TMP_BUF_SPT_IDX' ORDER BY SDO_INDEX_PRIMARY
    call count cpu elapsed disk query current rows
    Parse 1 0.04 0.03 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 2 0.00 0.00 0 2 0 1
    total 4 0.04 0.03 0 2 0 1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 36 (MDSYS) (recursive depth: 3)
    Rows Row Source Operation
    1 SORT ORDER BY (cr=2 pr=0 pw=0 time=366 us)
    1 TABLE ACCESS BY INDEX ROWID SDO_INDEX_METADATA_TABLE (cr=2 pr=0 pw=0 time=216 us)
    1 INDEX RANGE SCAN SDO_IDX_MDATA_IDX (cr=1 pr=0 pw=0 time=136 us)(object id 49332)
    error during execute of EXPLAIN PLAN statement
    ORA-00942: table or view does not exist
    parse error offset: 639
    SELECT nvl(sdo_level,0), nvl(sdo_numtiles,0), nvl(sdo_maxlevel, 0),
    sdo_index_table, sdo_index_primary, sdo_index_type, nvl(sdo_rtree_height, 0)
    , nvl(sdo_rtree_num_nodes, 0), nvl(sdo_rtree_dimensionality, 0),
    nvl(sdo_rtree_fanout, 0), nvl(sdo_rtree_root, 'EMPTY'),
    nvl(sdo_rtree_seq_name, 'DEFAULT'), sdo_index_partition,
    nvl(sdo_partitioned, 0), nvl(sdo_layer_gtype, 'DEFAULT'),
    nvl(sdo_index_dims, 0), nvl(sdo_rtree_pctfree, 10), nvl(sdo_rtree_quality,
    0), nvl(sdo_index_version, 0), nvl(sdo_tablespace, 'DEFAULT'),
    nvl(sdo_index_geodetic, 'FALSE'), sdo_index_status
    FROM
    sdo_index_metadata_table WHERE sdo_index_owner = 'APPDEV' and sdo_index_name
    = 'PT_SPATIAL_IDX' ORDER BY SDO_INDEX_PRIMARY
    call count cpu elapsed disk query current rows
    Parse 1 0.03 0.02 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 2 0.00 0.00 0 2 0 1
    total 4 0.03 0.02 0 2 0 1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 36 (MDSYS) (recursive depth: 3)
    Rows Row Source Operation
    1 SORT ORDER BY (cr=2 pr=0 pw=0 time=388 us)
    1 TABLE ACCESS BY INDEX ROWID SDO_INDEX_METADATA_TABLE (cr=2 pr=0 pw=0 time=236 us)
    1 INDEX RANGE SCAN SDO_IDX_MDATA_IDX (cr=1 pr=0 pw=0 time=138 us)(object id 49332)
    error during execute of EXPLAIN PLAN statement
    ORA-00942: table or view does not exist
    parse error offset: 639
    declare
    cost sys.ODCICost := sys.ODCICost(NULL, NULL, NULL, NULL);
    obj0 "MDSYS"."SDO_GEOMETRY" := "MDSYS"."SDO_GEOMETRY"(NULL, NULL, NULL, NULL, NULL);
    obj1 "MDSYS"."SDO_GEOMETRY" := "MDSYS"."SDO_GEOMETRY"(NULL, NULL, NULL, NULL, NULL);
    begin
    :1 := "MDSYS"."SDO_STATISTICS".ODCIStatsFunctionCost(
    sys.ODCIFuncInfo('MDSYS',
    'SDO_3GL',
    'RELATE',
    2),
    cost,
    sys.ODCIARGDESCLIST(sys.ODCIARGDESC(2, 'TRJ_TMP_BUF', 'APPDEV', '"SHAPE"', NULL, NULL, NULL), sys.ODCIARGDESC(2, 'PT_SOURCE', 'APPDEV', '"SHAPE"', NULL, NULL, NULL), sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL))
    , obj0, obj1, :5,
    sys.ODCIENV(:6,:7,:8,:9));
    if cost.CPUCost IS NULL then
    :2 := -1;
    else
    :2 := cost.CPUCost;
    end if;
    if cost.IOCost IS NULL then
    :3 := -1;
    else
    :3 := cost.IOCost;
    end if;
    if cost.NetworkCost IS NULL then
    :4 := -1;
    else
    :4 := cost.NetworkCost;
    end if;
    exception
    when others then
    raise;
    end;
    call count cpu elapsed disk query current rows
    Parse 2 0.01 0.00 0 0 0 0
    Execute 2 0.09 0.10 0 228 0 2
    Fetch 0 0.00 0.00 0 0 0 0
    total 4 0.10 0.11 0 228 0 2
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV) (recursive depth: 2)
    declare
    sel number;
    obj0 "MDSYS"."SDO_GEOMETRY" := "MDSYS"."SDO_GEOMETRY"(NULL, NULL, NULL, NULL, NULL);
    obj1 "MDSYS"."SDO_GEOMETRY" := "MDSYS"."SDO_GEOMETRY"(NULL, NULL, NULL, NULL, NULL);
    begin
    :1 := "MDSYS"."SDO_STATISTICS".ODCIStatsSelectivity(
    sys.ODCIPREDINFO('MDSYS',
    'SDO_3GL',
    'RELATE',
    173),
    sel,
    sys.ODCIARGDESCLIST(sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL), sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL), sys.ODCIARGDESC(2, 'TRJ_TMP_BUF', 'APPDEV', '"SHAPE"', NULL, NULL, NULL), sys.ODCIARGDESC(2, 'PT_SOURCE', 'APPDEV', '"SHAPE"', NULL, NULL, NULL), sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL)),
    :3,
    :4
    , obj0, obj1, :5,
    sys.ODCIENV(:6,:7,:8,:9));
    if sel IS NULL then
    :2 := -1;
    else
    :2 := sel;
    end if;
    exception
    when others then
    raise;
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.01 0 0 0 0
    Execute 1 0.06 0.05 0 180 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.07 0.06 0 180 0 1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV) (recursive depth: 2)
    select a.default_cpu_cost, a.default_io_cost
    from
    association$ a where a.obj# = :1
    and a.property = :2
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.00 0 0 0 0
    Execute 1 0.01 0.01 0 0 0 0
    Fetch 1 0.00 0.00 0 3 0 0
    total 3 0.02 0.02 0 3 0 0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Rows Row Source Operation
    0 TABLE ACCESS FULL ASSOCIATION$ (cr=3 pr=0 pw=0 time=208 us)
    declare
    cost sys.ODCICost := sys.ODCICost(NULL, NULL, NULL, NULL);
    obj1 "MDSYS"."SDO_GEOMETRY" := "MDSYS"."SDO_GEOMETRY"(NULL, NULL, NULL, NULL, NULL);
    obj2 "MDSYS"."SDO_GEOMETRY" := "MDSYS"."SDO_GEOMETRY"(NULL, NULL, NULL, NULL, NULL);
    begin
    :1 := "MDSYS"."SDO_STATISTICS".ODCIStatsIndexCost(
    sys.ODCIINDEXINFO('APPDEV',
    'TRJ_TMP_BUF_SPT_IDX',
    sys.ODCICOLINFOLIST(sys.ODCICOLINFO('APPDEV', 'TRJ_TMP_BUF', '"SHAPE"', 'SDO_GEOMETRY', 'MDSYS', NULL)),
    NULL,
    0,
    0),
    1.00000000,
    cost,
    sys.ODCIQUERYINFO(2,
    NULL),
    sys.ODCIPREDINFO('MDSYS',
    'SDO_RTREE_RELATE',
    NULL,
    141),
    sys.ODCIARGDESCLIST(sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL), sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL), sys.ODCIARGDESC(2, 'TRJ_TMP_BUF', 'APPDEV', '"SHAPE"', NULL, NULL, NULL), sys.ODCIARGDESC(2, 'PT_SOURCE', 'APPDEV', '"SHAPE"', NULL, NULL, NULL), sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL)),
    :6,
    :7
    , obj2, :8,
    sys.ODCIENV(:9,:10,:11,:12));
    if cost.CPUCost IS NULL then
    :2 := -1;
    else
    :2 := cost.CPUCost;
    end if;
    if cost.IOCost IS NULL then
    :3 := -1;
    else
    :3 := cost.IOCost;
    end if;
    if cost.NetworkCost IS NULL then
    :4 := -1;
    else
    :4 := cost.NetworkCost;
    end if;
    :5 := cost.IndexCostInfo;
    exception
    when others then
    raise;
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.01 0 0 0 0
    Execute 0 0.00 0.00 0 0 0 0
    Fetch 0 0.00 0.00 0 0 0 0
    total 1 0.01 0.01 0 0 0 0
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV) (recursive depth: 2)
    SELECT /*+ MERGE USE_NL(b) */ a.rowid, b.rowid
    from
    PT_SOURCE a, TRJ_TMP_BUF b WHERE sdo_relate(b.SHAPE, a.SHAPE, 'querytype=
    window mask=ANYINTERACT')= 'TRUE'
    call count cpu elapsed disk query current rows
    Parse 1 0.30 0.30 0 894 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.30 0.30 0 894 0 0
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV) (recursive depth: 1)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: ALL_ROWS
    0 NESTED LOOPS
    0 TABLE ACCESS MODE: ANALYZED (FULL) OF 'TRJ_TMP_BUF' (TABLE)
    0 TABLE ACCESS MODE: ANALYZED (FULL) OF 'PT_SOURCE' (TABLE)
    SELECT DIMINFO
    FROM
    ALL_SDO_GEOM_METADATA WHERE OWNER = 'APPDEV' AND TABLE_NAME = 'TRJ_TMP_BUF'
    AND COLUMN_NAME = 'SHAPE'
    call count cpu elapsed disk query current rows
    Parse 1 0.50 0.51 0 9 0 0
    Execute 1960 1.79 1.62 0 0 0 0
    Fetch 1960 8.38 8.13 0 43120 0 1960
    total 3921 10.67 10.27 0 43129 0 1960
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 58 (APPDEV) (recursive depth: 2)
    error during execute of EXPLAIN PLAN statement
    ORA-01039: insufficient privileges on underlying objects of the view
    parse error offset: 84
    SELECT signature, nhash, sqlarea_hash, last_used, inuse_features, flags,
    modified, incarnation
    FROM
    sql$ WHERE signature = :1
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.01 0.02 0 0 0 0
    Fetch 1 0.00 0.00 0 2 0 1
    total 3 0.01 0.02 0 2 0 1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 3)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID SQL$ (cr=2 pr=0 pw=0 time=162 us)
    1 INDEX UNIQUE SCAN I_SQL$SIGNATURE (cr=1 pr=0 pw=0 time=104 us)(object id 453)
    SELECT category
    FROM
    sqlprof$ WHERE signature = :1
    call count cpu e

  • Spatial Join on Topology feature layers

    I would like to be able to do a "spatial join" on topolgy feature layers. With sdo_geometry layers a spatial join finds ALL specified spatial interactions between complete layers. I would like to know if this is possible using topology feature layers, or if this functionality may be coming in the future along with (hopefully) sdo_topo_nn, sdo_topo_nn_distance, and sdo_topo_within_distance....?
    Alden

    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.

  • Tuning Large Spatial Join in Oracle 9i

    I have a large (million+ rows) table of line segments (2 point lines) and I want to generate a table of all intersections. I have created the geometry column and populated the values and indexed it with a spatial index.
    I even looked in the metadata to get the index table name (not same name as index itself)and computed statistics on the spatial index table.
    1. Was this really necessary?
    I do a join on the table as follows:
    Select a.LineID, b.LineID from Lines a, Lines b
    where
    mdsys.sdo_relate(a.LineSegment, b.LineSegment,
    'mask=anyinteract querytype=JOIN
    idxtab2=Line_SPATIAL_IDX') = 'TRUE';
    Everything I try results in nested full table scans.
    I have tried index table name in place of index name.
    2. Which should I really use?
    3. QueryType=Join is rarely used but this is what I need, right?
    4. Does the optimizer/explain plan accurately represent spatial operations?
    5. SDO_Join is not available in 9i and Oracle10 is not an option for me, so any idea's how to do this efficently, or at least any methods to optimize the SQL?
    I removed the Insert command and SDO_Intersection function so that I could tune the Select.
    (I know i will need to filter each lines intersection with itself, but I am not even to that point yet, this runs for days).
    Thanks,

    I have the horsepower to do a full scan once and I was hoping that the spatial index would be of some use to avoid nested scans (a million scans of a million rows).
    Anyone have insight on why SDO_RELATE would not use the spatial index? Index type make a difference?
    It is Geodetic data, so I used the tree index, maybe tiling would be better sdo_relate join?
    I am watching from Enterprise Console session screen. Does this show an accurate plan on SQL that uses Spatial Operators?
    Also since I am joining a table to itself, on the same column no less, is this outside the capability of sdo_relate? It won't let me put a 2nd spatial index on that column. Should it? Am I doing it wrong?
    Any help is appreciated. Thanks.

  • ORA-03232 Error on Spatial Join

    I am trying to run the following query. The tablesnames are pretty self explanitory.
    SELECT c.cnty,COUNTY(a.id)
    FROM county c,addr_points a
    WHERE SDO_RELATE(a.geoloc,c.geoloc,
    'mask = ANYINTERACT
    querytype = JOIN') = TRUE
    GROUP BY c.cnty;
    and am getting
    ORA-03232: unable to allocate an extent of 14 blocks from tablespace 2
    There is no such tablespace in our database, so we assumed it ment filename, which points to our rollback segments. These seem to be plenty large. We also not getting any alert logs that reflect this error. The docs on the error say to increase the default NEXT value on the tablespace, which we did. The current value is 5mb which is much larger than 14 blocks (block size is 8k).
    Any suggestions?
    Thanks
    null

    We got this to work, but we did it
    with a querytype=WINDOW instead of a JOIN.
    SELECT /*+ ORDERED */ c.cnty,COUNTY(a.id)
    FROM county c,
    addr_points a
    WHERE SDO_RELATE(a.geoloc,c.geoloc,
    'mask = ANYINTERACT querytype = WINDOW
    LAYER_GTYPE=POINT') = 'TRUE'
    GROUP BY c.cnty;
    ** A FEW NOTES **
    The ordered by hint is very important
    if you have more than one window
    getting passed into the second parameter
    of RELATE.
    Also when you use the ORDERED hint, it is
    important to make the table the windows
    are coming from listed first in the
    FROM clause.
    *** We are still looking into why
    the group by did not work with
    querytype = JOIN
    Will post something soon.
    Thanks.
    Dan
    null

  • Spatial join like UNION in ArcToolbox

    I loaded two polygon-shapefiles in Oracle Spatial. Now I'd like to make a spatial overlay on these two sets of geometries, which has to work like the UNION-analysis in ArcToolbox. This means that the result of the overlay must keep all the separate geometries, not just one geometry (like SDO_UNION). For each resulting polygon I want to know the ID from the original polygons.
    How can I do this?
    I was thinking of a combination of the SDO_INTERSECTION and the SDO_XOR functions, but do these functions also work for sets of geometries, or just for a pair of geometries?
    Thanks,
    Anja

    ok, now i understand. your query may work. the where is searching the intersecting geometries each to another. that looks good. your intersection/difference is searching the result out of your where.
    I see, you want to have the b geometry that is not covered by a and vice versa and also the union geometrie of both as new geometrie?
    i think your way is ok.
    i tried following - your idea has brought me to another implementation i_'Ve forgot for 2 months :(
    -- Create table
    drop table POLYTABLE1
    drop table POLYTABLE2
    create table POLYTABLE1
    ID NUMBER(12),
    GEOMETRY MDSYS.SDO_GEOMETRY
    create table POLYTABLE2
    ID NUMBER(12),
    GEOMETRY MDSYS.SDO_GEOMETRY
    INSERT INTO POLYTABLE1 (ID,GEOMETRY) VALUES(1,
    MDSYS.SDO_GEOMETRY(
    2003
    ,NULL
    ,NULL
    ,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1)
    ,MDSYS.SDO_ORDINATE_ARRAY(1,1,3,1,3,2,2,1,1,1)
    INSERT INTO POLYTABLE2 (ID,GEOMETRY) VALUES(2,
    MDSYS.SDO_GEOMETRY(
    2003
    ,NULL
    ,NULL
    ,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1)
    ,MDSYS.SDO_ORDINATE_ARRAY(2,1,4,1,4,2,2,2,2,1)
    insert into user_sdo_geom_metadata values ('POLYTABLE1','GEOMETRY',
    MDSYS.SDO_DIM_ARRAY(
    MDSYS.SDO_DIM_ELEMENT('X',0,10,0.05)
    ,MDSYS.SDO_DIM_ELEMENT('Y',0,10,0.05)
    ,NULL)
    insert into user_sdo_geom_metadata values ('POLYTABLE2','GEOMETRY',
    MDSYS.SDO_DIM_ARRAY(
    MDSYS.SDO_DIM_ELEMENT('X',0,10,0.05)
    ,MDSYS.SDO_DIM_ELEMENT('Y',0,10,0.05)
    ,NULL)
    create index i_geo_ptab1 on POLYTABLE1 (geometry) indextype is MDSYS.SPATIAL_INDEX
    create index i_geo_ptab2 on POLYTABLE2 (geometry) indextype is MDSYS.SPATIAL_INDEX
    SELECT a.id, b.id, SDO_GEOM.SDO_INTERSECTION(a.geometry, b.geometry, 0.05) intsxn_geom
    FROM polytable1 b, polytable2 a
    WHERE SDO_RELATE(a.geometry, b.geometry, 'mask=anyinteract')='TRUE'
    UNION ALL
    SELECT a.id, b.id, SDO_GEOM.SDO_DIFFERENCE(b.geometry, a.geometry, 0.05) intsxn_geom
    FROM polytable2 b, polytable1 a
    WHERE SDO_RELATE(a.geometry, b.geometry, 'mask=anyinteract')='TRUE'
    UNION ALL
    SELECT a.id, b.id, SDO_GEOM.SDO_DIFFERENCE(a.geometry, b.geometry, 0.05) intsxn_geom
    FROM polytable2 b, polytable1 a
    WHERE SDO_RELATE(a.geometry, b.geometry, 'mask=anyinteract')='TRUE'
    the results are very interesting... i think: FALSE!! I am using a Oracle Database 10g Enterprise Edition Release 10.1.0.4.0...
    can u compare with my reults?
    SQL> SELECT a.id, b.id, SDO_GEOM.SDO_INTERSECTION(a.geometry, b.geometry, 0.05) intsxn_geom
    2 FROM polytable1 b, polytable2 a
    3 WHERE SDO_RELATE(a.geometry, b.geometry, 'mask=anyinteract')='TRUE'
    4 UNION ALL
    5 SELECT a.id, b.id, SDO_GEOM.SDO_DIFFERENCE(b.geometry, a.geometry, 0.05) intsxn_geom
    6 FROM polytable2 b, polytable1 a
    7 WHERE SDO_RELATE(a.geometry, b.geometry, 'mask=anyinteract')='TRUE'
    8 UNION ALL
    9 SELECT a.id, b.id, SDO_GEOM.SDO_DIFFERENCE(a.geometry, b.geometry, 0.05) intsxn_geom
    10 FROM polytable2 b, polytable1 a
    11 WHERE SDO_RELATE(a.geometry, b.geometry, 'mask=anyinteract')='TRUE';
    2 1 SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(2, 1, 3, 1, 3, 2, 2, 1))
    1 2 SDO_GEOMETRY(2007, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1, 11, 1003, 1), SDO_ORDINATE_ARRAY(3, 1, 4, 1, 4, 2, 3, 2, 3, 1, 2, 2, 2, 1, 3, 2, 2, 2))
    1 2
    ! this also doesn't work correct with difference set to 1 (in metadata and geoemetry)!
    Message was edited by:
    Andreas Brodkorb

  • Spatial vs. materialized views/query rewrite

    Dear all,
    we are trying to use Spatial (Locator) functionality together with performance optimization using materialized views and query rewrite, and it does not seem to work. Does anybody has experience with this?
    The problem in more detail:
    * There is a spatial attribut (vom Typ GEOMETRY) in our table;
    * we define a materialized view on that table;
    * we run a query that could be better answered using the materialized view with query rewrite;
    *the optimizer does not choose the plan using the materialized view, query rewrite does not take place;
    This happenes, even if neither the materialized view, nor the query contains the spatial attribut.
    The explanation given by the procedure DBMS_MVIEW.Explain_Rewrite is:
    "QSM-01064 query has a fixed table or view Cause: Query
    rewrite is not allowed if query references any fixed tables or views"
    We are using Oracle 9R2, Enterprise Edition, with locator. Nevertheless, it would also be interesting, if there is any improvement in 10g?
    A more complicated task, using materialized views to optimize spatial operations (e.g., sdo_relate) would also be very interesting, as spatial joins are very expensive operations.
    Thanks in advance for any comments, ideas!
    Cheers,
    Gergely Lukacs

    Hi Dan,
    thanks for your rapid response!
    A simple example is:
    alter session set query_rewrite_integrity=trusted;
    alter session set query_rewrite_enabled=true;
    set serveroutput on;
    /* Creating testtable */
    CREATE TABLE TESTTABLE (
    KEY1 NUMBER (4) NOT NULL,
    KEY2 NUMBER (8) NOT NULL,
    KEY3 NUMBER (14) NOT NULL,
    NAME VARCHAR2 (255),
    X NUMBER (9,2),
    Y NUMBER (9,2),
    ATTR1 VARCHAR2 (2),
    ATTR2 VARCHAR2 (30),
    ATTR3 VARCHAR2 (80),
    ATTR4 NUMBER (7),
    ATTR5 NUMBER (4),
    ATTR6 NUMBER (5),
    ATTR7 VARCHAR2 (40),
    ATTR8 VARCHAR2 (40),
    CONSTRAINT TESTTABLE_PK
    PRIMARY KEY ( KEY1, KEY2, KEY3 ));
    /* Creating materialized view */
    CREATE MATERIALIZED VIEW TESTTABLE_MV
    REFRESH COMPLETE
    ENABLE QUERY REWRITE
    AS SELECT DISTINCT ATTR7, ATTR8
    FROM TESTTABLE;
    /* Creating statistics, just to make sure */
    execute dbms_stats.gather_table_stats(ownname=> 'TESTSCHEMA', tabname=> 'TESTTABLE', cascade=>TRUE);
    execute dbms_stats.gather_table_stats(ownname=> 'TESTSCHEMA', tabname=> 'TESTTABLE_MV', cascade=>TRUE);
    /* Explain rewrite procedure */
    DECLARE
    Rewrite_Array SYS.RewriteArrayType := SYS.RewriteArrayType();
    querytxt VARCHAR2(1500) :=
    'SELECT COUNT(*) FROM (
    SELECT DISTINCT
    ATTR8 FROM
    TESTTABLE
    i NUMBER;
    BEGIN
    DBMS_MVIEW.Explain_Rewrite(querytxt, 'TESTTABLE_MV', Rewrite_Array);
    FOR i IN 1..Rewrite_Array.count
    LOOP
    DBMS_OUTPUT.PUT_LINE(Rewrite_Array(i).message);
    END LOOP;
    END;
    The message you get is:
    QSM-01009 materialized view, string, matched query text
    Cause: The query was rewritten using a materialized view, because query text matched the materialized view text.
    Action: No action required.
    i.e. query rewrite works!
    /* Adding geometry column to the testtable -- not to the materialized view, and not to the query! */
    ALTER TABLE TESTTABLE
    ADD GEOMETRYATTR mdsys.sdo_geometry;
    /* Explain rewrite procedure */
    DECLARE
    Rewrite_Array SYS.RewriteArrayType := SYS.RewriteArrayType();
    querytxt VARCHAR2(1500) :=
    'SELECT COUNT(*) FROM (
    SELECT DISTINCT
    ATTR8 FROM
    TESTTABLE
    i NUMBER;
    BEGIN
    DBMS_MVIEW.Explain_Rewrite(querytxt, 'TESTTABLE_MV', Rewrite_Array);
    FOR i IN 1..Rewrite_Array.count
    LOOP
    DBMS_OUTPUT.PUT_LINE(Rewrite_Array(i).message);
    END LOOP;
    END;
    The messages you get are:
    QSM-01064 query has a fixed table or view
    Cause: Query rewrite is not allowed if query references any fixed tables or views.
    Action: No action required.
    QSM-01019 no suitable materialized view found to rewrite this query
    Cause: There doesn't exist any materialized view that can be used to rewrite this query.
    Action: Consider creating a new materialized view.
    i.e. query rewrite does not work!
    If this works, the next issue is to use materialized views for optimizing spatial operations, e.g., a spatial join. I can supply you with an example, if necessary (only makes sense, I think, after the first problem is solved).
    Thanks in advance for any ideas, comments!
    Cheers,
    Gergely

  • Spatial query performance problems

    In preparation for making using of spatial data in our oracle database, I wanted to create a view (materialised) that brings together data from a few different tables into one place ready for publishing as a WMS layer.
    I'm being stumped at first base by crippling performance of Oracle spatial function. Later joins of ordinary fields are ok, but the spatial joining of two tables using the following sql runs for an absurd length of time (i've given up - I don't know how long it actually takes only that it takes far too long)
    SELECT /*+ ordered */
    lg.GRIDREF, lg.SYSTEM, lg.PARENT, lg.TYPE,
    lrd.REGION_CODE
    FROM TABLE (SDO_JOIN('L_GRIDS','BOUNDARY','L_REGION_DEFINITION','BOUNDARY','mask=COVERS')) c,
    L_GRIDS lg, L_REGION_DEFINITION lrd
    WHERE c.rowid1 = lg.rowid AND c.rowid2 = lrd.rowid
    ORDER BY lrd.REGION_CODE
    Both tables have spatial indexs. L_REGION_DEFINITION contains 200 rows with complex boundaries stored as spatial objects. L_GRIDS contains 475,000 rows, each with a trivially simple spatial object consisting of a square polygon of 4 points.
    The database is 10g patched to latest. The server is dual quad Xeon processors with 16gb of ram. I didn't expect it to be a lightning query, but surely it should be usable?
    Any ideas?

    Try to upgrade to at least 11.2.0.2 and use the following query
    SELECT /*+ leading(lrd lg) */
    lg.GRIDREF, lg.SYSTEM, lg.PARENT, lg.TYPE,
    lrd.REGION_CODE
    FROM L_GRIDS lg, L_REGION_DEFINITION lrd
    WHERE sdo_relate(lg.boundary, lrd.boundary, 'mask=COVEREDBY') = 'TRUE'
    ORDER BY lrd.REGION_CODE;
    And since not sure about your query's intention, maybe it is "mask=INSIDE+COVEREDBY",
    please check out oracle spatial developer guide for details about different masks.

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

  • Combined flat (regular) and Spatial query

    DB: Oracle 8.1.7.2.1 (8i Release 3, patch 81721)
    I performed a spatial query on the results of a regular query, in the form of:
    Select count(*) from
    (select * from myTable where key=...)
    WHERE (MDSYS.SDO_RELATE("GEOLOC",
    MDSYS.SDO_GEOMETRY(2003,NULL,null,
    MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),
    MDSYS.SDO_ORDINATE_ARRAY(-118.83939716391866,
    29.951783100000025, -100.20650379608135,
    40.52319191999998)),
    'mask=ANYINTERACT layer_gtype=POINT
    querytype = WINDOW')='TRUE');
    The first flat query results in a small number of records and takes minimum time if run separately.
    Select count(*) from
    (select * from myTable where key=...)
    However, when appended the spatial join condition, it takes a long time, same as querying from the whole dataset without the first flat query. I tried to optimize the spatial index and it did not help much.
    Why isn't the spatial query taking advantage of the flat query? Can I somehow force it to do so to improve the performance? (This is a dynamic query in an application.)
    Thanks.

    Hi
    I have a similar problem and i'd like to know if anyone have got a solution.
    We are developing a vehicle localization system.
    The amount of data it's about 6 million positions per year.
    The queries to the data could be the actual location of the vehicle (100 vehicles) or historical locations.
    For historical location we have partitioned the table an index by date (each week), and for actual location we have created a bitmap index based on field L_ULTIMA.
    Allwais the queries are filtered by alfanumeric conditions more restrictive then spatial (range of dates or last_location).
    When runnin alfanumeric queries over a subset of une million rows, it takes only few seconds (even less) but when including spatial conditions (SDO_RELATE to a rectangle) it takes more than one minute.
    We have tried different hints to force the use of bitmap index but in all cases the execution plan uses de spatial index.
    It's there any way to combine spatial and flat indexes?
    SELECT
    COUNT(*)
    FROM SLFP_LOCALIZACIONES A
    WHERE sdo_relate(A.geom, mdsys.sdo_geometry(2003,NULL,NULL,
    mdsys.sdo_elem_info_array(1,1003,3),
    mdsys.sdo_ordinate_array(159657,3978069, 546051,4116358)),
    'mask=anyinteract querytype=window') = 'TRUE';
    COUNT(*)
    899073
    Transcurrido: 00:02:126.34
    SELECT /*+ INDEX_COMBINE(A SLFP_LOCALI_ULTIMA_I) */
    COUNT(*)
    FROM SLFP_LOCALIZACIONES A
    WHERE sdo_relate(A.geom, mdsys.sdo_geometry(2003,NULL,NULL,
    mdsys.sdo_elem_info_array(1,1003,3),
    mdsys.sdo_ordinate_array(159657,3978069, 546051,4116358)),
    'mask=anyinteract querytype=window') = 'TRUE' AND
    A.L_ULTIMA = 1;
    COUNT(*)
    102
    Transcurrido: 00:02:121.00
    SELECT COUNT(*) FROM SLFP_LOCALIZACIONES WHERE L_ULTIMA = 1
    COUNT(*)
    104
    Transcurrido: 00:00:00.72
    SQL> SELECT /*+ INDEX_COMBINE(A SLFP_LOCALI_ULTIMA_I) */
    2 COUNT(*)
    3 FROM SLFP_LOCALIZACIONES A
    4 WHERE N_X >= 159657 AND
    5 N_X <= 546051 AND
    6 N_Y >= 3978069 AND
    7 N_Y <= 4116358 AND
    8 A.L_ULTIMA = 1;
    COUNT(*)
    102
    Transcurrido: 00:00:00.59

  • SDO_RELATE JOIN

    Oracle9i Question: Has anyone anywhere ever actually seen this spatial operator use the spatial index from both the tables in the join?
    (Full table scans just won't cut it.)
    Any hints, help, sample SQL or other insights are greatly appreciated.
    Thank you.

    In Oracle9i it is recommended that window queries be used when doing a spatial join. In Oracle Spatial 10g a new pseudo-operator sdo_join is introduced which will further enhance performance of spatial joins.
    In Oracle9i, lets say you want to get all of the city/county pairs. Using the sample tables used for the course, there are 195 cities, and 3230 counties.
    To get all of the city/county pairs, I would write the query as follows:
    select /*+ ordered */ a.city, b.county
    from geod_cities a, geod_counties b
    where sdo_relate(b.geom, a.location,
    'querytype=window mask=anyinteract') = 'TRUE';
    Some notes on the query:
    1) Use the ordered hint, and put the table the window comes from (geometry2) first in the from clause.
    2) Use the table with smaller cardinality as the window table (note that cities has 195 rows, counties has 3230 rows).
    3) If both tables have the same cardinality, and one has polygons and the other is of some other type, use the polygon table as the window table to enable the largest number of optimizations within spatial.
    Hope this helps.

  • Unable to run spatial operations through dblinks

    Hello All,
    I am trying to run spatial operations through dblinks. Please see the example query below
    select a.OGC_GEOMETRY.sdo_gtype from <table>@dblink a where sdo_nn(a.OGC_GEOMETRY,mdsys.sdo_geometry(2001,null,mdsys.sdo_point_type(0,0,null),null,null),'sdo_num_res=1')='TRUE'.
    Query fails with the following error
    ORA-13249:
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 17
    ORA-06512: at "MDSYS.PRVT_IDX", line 9
    *13249. 00000 - "%s"*
    **Cause: An internal error was encountered in the extensible spatial index*
    component. The text of the message is obtained from some
    other server component.
    **Action: Contact Oracle Support Services with the exact error text.*
    Same Query runs fine in the original database but fails with dblinks. Is it possible to run spatial operations through dblink?
    Thanks & Regards,
    Jasti

    I've never used spatial myself but this other user had issues with it and dblinks. They ended up using the dblink to create a local materialized view with local indexes and used those.
    MapBuilder does not work with DB-link in a spatial view
    Found this as well. Does it mean anything to you?
    4.2 Querying Spatial Data
    This section describes how the structures of a Spatial layer are used to resolve spatial queries and spatial joins.
    Spatial uses a two-tier query model with primary and secondary filter operations to resolve spatial queries and spatial joins, as explained in Section 1.6. The term two-tier indicates that two distinct operations are performed to resolve queries. If both operations are performed, the exact result set is returned.
    You cannot append a database link (dblink) name to the name of a spatial table in a query if a spatial index is defined on that table.
    If a spatial index is created in a database that was created using the UTF8 character set, spatial queries that use the spatial index will fail if the system parameter NLS_LENGTH_SEMANTICS is set to CHAR. For spatial queries to succeed in this case, the NLS_LENGTH_SEMANTICS parameter must be set to BYTE (its default value).
    http://docs.oracle.com/cd/B13789_01/appdev.101/b10826/sdo_index_query.htmEdited by: Gaff on Aug 16, 2012 4:46 PM

  • Problem using two function based indexes at once!

    Hello Oracle!
    I've got problems using two function based indexes on geometries at once.
    The problem occures, when I use a spatial join between two geometries both using function based indexes.
    The test case:
    CREATE TABLE quad (centroid NUMBER);
    CREATE TABLE points (no NUMBER, point MDSYS.SDO_GEOMETRY);
    CREATE OR REPLACE FUNCTION getQuad (centroid NUMBER) RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC IS
    BEGIN
    RETURN MDSYS.SDO_GEOMETRY(2003, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(centroid-5,centroid-5,centroid+5,centroid-5,centroid+5,centroid+5,centroid-5,centroid+5,centroid-5,centroid-5));
    END;
    INSERT INTO USER_SDO_GEOM_METADATA VALUES('quad','tiedge.getQuad(centroid)',MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X', -100, 100, .0000001), MDSYS.SDO_DIM_ELEMENT('Y', -100, 100, .0000001)),NULL);
    CREATE INDEX quad_idx on quad(getQuad(centroid)) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    INSERT INTO quad VALUES (0);
    INSERT INTO quad VALUES (5);
    INSERT INTO quad VALUES (10);
    INSERT INTO points VALUES (1, MDSYS.SDO_GEOMETRY(1001,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),MDSYS.SDO_ORDINATE_ARRAY(4,4)));
    ALTER SESSION SET QUERY_REWRITE_INTEGRITY=TRUSTED;
    ALTER SESSION SET QUERY_REWRITE_ENA[i]Long postings are being truncated to ~1 kB at this time.

    hi there,
    For a better audience for this question, I'd look at the database forum.
    guys on that will be a lot more familiar with FBIs
    thanks
    Barry

  • To improve the efficiency

    hi all,
    I have written the following script to do near analysis on road and point data type. Road table has 36629 road and point table has 10834 points and want to identify all points which are within one km of the road.
    Query is running even after 24 hours though spatial column in road table is indexed, any comment is highly appretiated to improve efficiency.
    <script>
    INSERT /*+APPEND*/  INTO REL161_AU_POI_ACT_NR1 ( PT_IDX , X ,Y,RD_IDX, DISTANCE, GEOM   )(
    SELECT /*+ ORDERED USE_NL(p,r) */ p.idx ,p.X,p.Y, r.ID_NUMBER, SDO_NN_DISTANCE(1),
    MDSYS.SDO_GEOMETRY(2001,8311,MDSYS.SDO_POINT_TYPE(P.X,P.Y,NULL),NULL,NULL)
    sdo_shape FROM point P,
    road R
    WHERE SDO_NN( r.GEOM, MDSYS.SDO_GEOMETRY(2001,8311,MDSYS.SDO_POINT_TYPE(P.X,P.Y,NULL),NULL,NULL), 'sdo_batch_size=10 UNIT=KM',1) = 'TRUE'
    AND SDO_NN_DISTANCE(1) <= 1)
    </script>
    Best Regards,
    Vaneeza

    Vaneeza
    Have you tried using sdo_within_distance operator? You want to know ALL objects within a distance of 1KM, as opposed to the X nearest objects, for which the SDO_NN operator is more suitable. The SDO_NN operator will return the objects ordered based on their distance before applying the other where clauses.
    There is no limit on numbers of nearest objects set in your query
    By having set the sdo_batch_size=10, the SDO_NN will evaluate the nearest candidates against the other clauses untill they are TRUE. What I am not sure here is whether the operator stops after having the first candidate evaluated to FALSE for the SDO_NN_DISTANCE(1) < 1 (your distance criteria) or whether the operator still process all nearest candidates as there is no explicit limitations on the number of nearest neighbors. (maybe one of the Oracle guys can comment this and decide if that might cause the general long processing time).
    Within 11g you can have the distance set as a parameter of the SDO_NN operator, not as an additional where clause (which might be the only distance influence to the index use within the operator, but again this is for the oracle guys to comment)
    Also, you want for all points find all roads within a distance of 1 KM of the points, not one specific point. In that case it might, if feasible, be better to store the points as sdo_geometry explicitly with a spatial index. Then you can use a spatial join with the distance parameter and have the distance between the object calculated using the sdo_geom.sdo_distance function.
    Luc
    Edited by: lucvanlinden on May 25, 2009 10:50 PM

Maybe you are looking for

  • What is the relationship between Process and Session parameter in Oracle

    Hi All I ran into a problem "ORA-00020: maximum number of processes (150) exceeded " on the other day and I want to fix this temporary by increase the process by some number like 200. Someone suggesting the syntax to fix my problem then the database

  • MSI 600 Twin Frozr not full screen without driver

    Hi, i have a problem with my new vga, in the bios or in safe mode or in windows (without driver) does not display in full screen. With my old 6950 i did not have this problem and now i just replaced only the vga. bios screen i45.tinypic.com/uueev.jpg

  • How to transfer data from a program to excel format?

    Hi, <h4> I want to convert the abap output to excel format. Please tell me how to do it?</h4> Megha Jain.

  • Best camera for importing HD video files native to FCP?

    I am researching what type of HD video camera to buy.  The goal is to have video material captured to a memory card or stick and have the resultant video files available for direct import into FCP.  I have used  rented cameras in the past where I had

  • How to remove a stripped screw from an iPhone 4?

    Since APPLE is so kind as to tell me "You broke your iPhone's home button, you can replace the phone for $200 I decided I'll just open it up and replace it myself!" I just recently went to replace my iPhone 4 screen/home button and find a stripped sc