A Developers Guide to ArcGIS 10 Geodatabase Data Types ......–One expects a full table scan •...

10
A Developers Guide to ArcGIS 10 Geodatabase Data Types Native spatial types for Oracle Native spatial types for Oracle Thomas Brown Thomas Brown

Transcript of A Developers Guide to ArcGIS 10 Geodatabase Data Types ......–One expects a full table scan •...

Page 1: A Developers Guide to ArcGIS 10 Geodatabase Data Types ......–One expects a full table scan • Zoom into a small area – One expects the spatial index to be the access pathOne

A Developers Guide to ArcGIS 10 Geodatabase Data Types

Native spatial types for OracleNative spatial types for Oracle

Thomas BrownThomas Brown

Page 2: A Developers Guide to ArcGIS 10 Geodatabase Data Types ......–One expects a full table scan • Zoom into a small area – One expects the spatial index to be the access pathOne

Session prerequisitesSession prerequisitesSession prerequisites…Session prerequisites…

•• An understanding of Spatial TypesAn understanding of Spatial Types•• Familiar with many SQL concepts and syntaxFamiliar with many SQL concepts and syntax•• And likely using Oracle andAnd likely using Oracle and st geometryst geometry•• And likely using Oracle and And likely using Oracle and st_geometryst_geometry

•• If not, then please attend the session, If not, then please attend the session, –– “Accessing your “Accessing your geodatabasegeodatabase outside of outside of ArcObjectsArcObjects””

Di i ti l tDi i ti l t•• Discussion on spatial typesDiscussion on spatial types•• Best practices on how to use SQL to leverage your spatial Best practices on how to use SQL to leverage your spatial

assetsassets

Page 3: A Developers Guide to ArcGIS 10 Geodatabase Data Types ......–One expects a full table scan • Zoom into a small area – One expects the spatial index to be the access pathOne

ESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleCurrent state…Current state…

•• The biggest performance problem when working with The biggest performance problem when working with st_geometryst_geometry……

–– Oracle’s shared pool and its caching of execution plansOracle’s shared pool and its caching of execution plansp g pp g p

•• Display a feature class at full extentDisplay a feature class at full extent–– One expects a full table scanOne expects a full table scan

•• Zoom into a small areaZoom into a small area–– One expects the spatial index to be the access pathOne expects the spatial index to be the access pathOne expects the spatial index to be the access pathOne expects the spatial index to be the access path

See Knowledge Base article: 37468Oracle’s optimizer uses a full table scan when executing aquery against a st_geometry attribute

Page 4: A Developers Guide to ArcGIS 10 Geodatabase Data Types ......–One expects a full table scan • Zoom into a small area – One expects the spatial index to be the access pathOne

ESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleCurrent state…Current state…

•• What is the solution?What is the solution?–– Flush the shared pool…Flush the shared pool…–– Use stored outlines…Use stored outlines…UU–– Ping the SQL statement with the index access path…Ping the SQL statement with the index access path…–– Prevent users from accessing the data…Prevent users from accessing the data…

•• Use Use st_geometry’sst_geometry’s extensibilityextensibility–– Set the feature classes selectivitySet the feature classes selectivityyy–– sde.spx_util.set_operator_selectivitysde.spx_util.set_operator_selectivity

See Knowledge Base article: 32605See Knowledge Base article: 32605 Set st_geometry relational operator selectivity in Oracle

Page 5: A Developers Guide to ArcGIS 10 Geodatabase Data Types ......–One expects a full table scan • Zoom into a small area – One expects the spatial index to be the access pathOne

ESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleCurrent state… 9.3.1 SP1Current state… 9.3.1 SP1

•• Improved spatial relational operator performance with Improved spatial relational operator performance with secondary filteringsecondary filtering

–– st_intersectsst_intersects, , st_withinst_within, , stst_*_*__ ,, __ ,, __

See Knowledge Base article: 37509E t i O l ORA 29903 tiEncountering Oracle error ORA-29903 error executingODCIIndexFetch() routine when using spatial relationaloperators with st_geometry

See Knowledge Base article: 37528Poor performance using st geometry spatial relationalPoor performance using st_geometry spatial relationaloperators when multiple grids are present

Page 6: A Developers Guide to ArcGIS 10 Geodatabase Data Types ......–One expects a full table scan • Zoom into a small area – One expects the spatial index to be the access pathOne

ESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleCurrent state… 9.3.1 SP1Current state… 9.3.1 SP1

•• Optimization when creating spatial indexesOptimization when creating spatial indexes–– Primary reason to avoid Oracle shared pool memory leaksPrimary reason to avoid Oracle shared pool memory leaks–– Significant decrease in time when building a spatial indexSignificant decrease in time when building a spatial indexS g g pS g g p–– Use of Use of dbms_sqldbms_sql and array insertsand array inserts

See Knowledge Base article: 37465Encountering Oracle error ORA-4030 when creating a spatial indexindex

Page 7: A Developers Guide to ArcGIS 10 Geodatabase Data Types ......–One expects a full table scan • Zoom into a small area – One expects the spatial index to be the access pathOne

ESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleCurrent state… 9.3.1 SP1Current state… 9.3.1 SP1

• st_buffer_intersects operator optimization reduces the number of individual calls to the shape engine

– Allowing the request to be processed in one call…g q p

SELECT a.address, a.pin, st_distance(a.shape,b.shape)

FROM parcels a, busstops b

WHERE a.appraisal < 125000 AND a.zoning = ‘SFR’

AND st_buffer_intersects(b.busstops,a.shape,2640) = 1

– st_intersects/st_buffer elapsed time: 00:00:52.21– st_buffer_intersects elapsed time: 00:00:17.89

Page 8: A Developers Guide to ArcGIS 10 Geodatabase Data Types ......–One expects a full table scan • Zoom into a small area – One expects the spatial index to be the access pathOne

ESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleData creation or data loadingData creation or data loading

•• The fastest way to load data is by using array inserts…The fastest way to load data is by using array inserts…

DECLARE

S (100) O dTYPE geom_type IS VARRAY(100) OF sde.st_geometry;

geom_array geom_type := geom_type();

BEGIN

local_geom := sde.st_geometry(geom_txt,srid);

geom_array.extend;

geom_array(geom_array.count) := local_geom;

FORALL i IN 1 100FORALL i IN 1..100

INSERT INTO point_events (objectid, shape) VALUES (r46.nextval, geom_array(i));

See Knowledge Base article: 37694How to: Bulk insert st_geometry attributes in Oracle

Page 9: A Developers Guide to ArcGIS 10 Geodatabase Data Types ......–One expects a full table scan • Zoom into a small area – One expects the spatial index to be the access pathOne

ESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleArcGISArcGIS 10.0 and Query Layers10.0 and Query Layers

•• Query layers provides read access to table’s with spatial Query layers provides read access to table’s with spatial attributes which are not registered with the attributes which are not registered with the geodatabasegeodatabase

•• Using complex operators, aggregates, analytic functions Using complex operators, aggregates, analytic functions can result in poor performance and high CPU usage on the can result in poor performance and high CPU usage on the database serverdatabase serverdatabase serverdatabase server

•• Attempt to keep the query definition simple for optimal Attempt to keep the query definition simple for optimal p p q y p pp p q y p pperformanceperformance

Page 10: A Developers Guide to ArcGIS 10 Geodatabase Data Types ......–One expects a full table scan • Zoom into a small area – One expects the spatial index to be the access pathOne

ESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleESRI Spatial Type for OracleArcGISArcGIS 10.0 new functionality10.0 new functionality

•• Improved insert/update performance…Improved insert/update performance…–– No longer returning the LOB locator for inserting or updating No longer returning the LOB locator for inserting or updating

the geometry objectthe geometry object–– Addresses issues with partitioning and cursor leaksAddresses issues with partitioning and cursor leaks–– Fixes BEFORE/AFTER triggers Fixes BEFORE/AFTER triggers

•• Nearest NeighborNearest Neighbor

•• Optimized point constructorOptimized point constructor–– sde.st_geometrysde.st_geometry((x,y,z,m,sridx,y,z,m,srid))

Geometry construction occurs within processGeometry construction occurs within process–– Geometry construction occurs within processGeometry construction occurs within process