Frequently asked question
Code:
create table ch_att as
select objected, name
from churches
where objected < 100;
Note:
Make sure to place an index on the objectid column for the join. (Critical for performance)
Code:
sdetable -o create_view -T V_church -t "church,ch_att" -c "shape,church.objectid, ch_att.name " -w "church.objectid=ch_att.objectid" -u gisdba -p gisdba
Select count(*) from V_churches;
Code:
SELECT /*+ FIRST_ROWS */ shape, church.objectid, ch_att.name
FROM GISDBA.CHURCH, GISDBA.CH_ATT
WHERE church.objectid=ch_att.objectid
********************************************************************************
SELECT /*+ INDEX(SHAPE F37_UK1) */ S_.eminx,S_.eminy,S_.emaxx,S_.emaxy,
SHAPE.fid,SHAPE.numofpts,SHAPE.entity,SHAPE.points,SHAPE.rowid
FROM
(SELECT /*+ INDEX(SP_ S37_IX1) */ DISTINCT sp_fid,eminx,eminy,emaxx,emaxy
FROM GISDBA.S37 SP_ WHERE SP_.gx >= :1 AND SP_.gx <= :2 AND SP_.gy >= :3
AND SP_.gy <= :4 AND SP_.eminx <= :5 AND SP_.eminy <= :6 AND SP_.emaxx >=
:7 AND SP_.emaxy >= :8) S_, GISDBA.V_CHURCH , GISDBA.F37 SHAPE WHERE
S_.sp_fid = SHAPE.fid AND S_.sp_fid = GISDBA.V_CHURCH.SHAPE
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.01 0.03 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.08 0.20 0 7745 0 87
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3 0.09 0.25 0 7745 0 87
Misses in library cache during parse: 1
Optimizer goal: FIRST_ROWS
Parsing user id: 82
Rows Row Source Operation
------- ---------------------------------------------------
87 NESTED LOOPS (cr=7658 r=0 w=0 time=201597 us)
87 NESTED LOOPS (cr=7482 r=0 w=0 time=200446 us)
3725 NESTED LOOPS (cr=7480 r=0 w=0 time=189075 us)
3725 VIEW (cr=28 r=0 w=0 time=148248 us)
3725 SORT UNIQUE (cr=28 r=0 w=0 time=146506 us)
3725 FILTER (cr=28 r=0 w=0 time=17088 us)
3725 INDEX RANGE SCAN S36_IX1 (cr=28 r=0 w=0 time=15270 us)(object id 44993)
3725 TABLE ACCESS BY INDEX ROWID CHURCH (cr=7452 r=0 w=0 time=32687 us)
3725 INDEX UNIQUE SCAN A36_IX1 (cr=3727 r=0 w=0 time=16423 us)(object id 44991)
87 INDEX UNIQUE SCAN C_ATT_OB_IDX (cr=2 r=0 w=0 time=5538 us)(object id 45003)
87 TABLE ACCESS BY INDEX ROWID F36 (cr=176 r=0 w=0 time=933 us)
87 INDEX UNIQUE SCAN F36_UK1 (cr=89 r=0 w=0 time=493 us)(object id 44988)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net more data to client 3 0.00 0.00
SQL*Net message from client 1 8.96 8.96
********************************************************************************
Code:
SELECT /*+ INDEX(SP_ S37_IX1) */ DISTINCT sp_fid,eminx,eminy,emaxx,emaxy
FROM GISDBA.S37 SP_ WHERE SP_.gx >= :1 AND SP_.gx <= :2 AND SP_.gy >= :3
AND SP_.gy <= :4 AND SP_.eminx <= :5 AND SP_.eminy <= :6 AND SP_.emaxx >=
:7 AND SP_.emaxy >= :8)
Code:
3725 SORT UNIQUE (cr=28 r=0 w=0 time=146506 us)
3725 FILTER (cr=28 r=0 w=0 time=17088 us)
3725 INDEX RANGE SCAN S36_IX1 (cr=28 r=0 w=0 time=15270 us)(object id 44993)
Note:
At ArcSDE 9.0, when you add the view to ArcMap as a feature class, one of the properties of the layer is to set if you want a spatial, or attribute query to be done first. Therefore, in ArcGIS 9.0, you can get around this performance problem.
Article ID:000006985
Get help from ArcGIS experts
Download the Esri Support App