I. 空間索引
對於空間資料中幾何對象的索引顯然不能套用資料庫現有的索引類型,其不確定的資料結構和資料操作方法使現有的索引並不能適用,因此無論是Oracle Spatial還是ArcSDE都是採用域索引(Domain Index[1]
)來實現,簡單地說就是建立一個資料庫中原來沒有的新的索引類型。
· Oracle Spatial
1. 索引類型SPATIAL_INDEX
Oracle Spatial中的空間索引極其重要,沒建空間索引的空間表就像斷了腿的兔子,不但跑不起來,甚至可能比烏龜還慢。
讓我們從索引的建立入手來看一下Oracle Spatial的空間索引機制:
SQL> create index idx_test_index_geom on spatial.test_index(geom) indextype is mdsys.spatial_index;
索引已建立。
如果你的資料是用shp2sdo等工具匯入的,那麼直接就可以建立索引;如果是自己建立的空間表,那麼必然會遇到ORA-13203錯誤,因為Oracle Spatial在建立空間索引時會讀取USER_SDO_GEOM_METADATA視圖中相關的資訊,如果沒有就會報錯,因此,對於自己建立的空間表,又需要建立索引的話(這簡直是一句廢話,沒索引的殘廢空間表有什麼用),就一定要在這個視圖插入這個空間表的相關資訊:
SQL> insert into mdsys.user_sdo_geom_metadata(table_name,column_name,diminfo) values ('TEST_INDEX','GEOM',
SDO_DIM_ARRAY(
SDO_DIM_ELEMENT('X',1,100000,1),
SDO_DIM_ELEMENT('Y',1,100000,1)));
這裡我們告訴Oracle Spatial,我的這個空間表名字叫“TEST_INDEX”,幾何欄位名字叫“GEOM”,X、Y方向上的座標範圍都是1到100000,容差是1。順便看一下SDO_DIM_ELEMENT的定義,其中幾個屬性的含義在下面寫了點注釋:
CREATE OR REPLACE
TYPE SDO_DIM_ELEMENT AS OBJECT (
SDO_DIMNAME VARCHAR(64), --座標維的名稱
SDO_LB NUMBER, --座標下界
SDO_UB NUMBER, --座標上界
SDO_TOLERANCE NUMBER ) --座標容差
好了,再把視線轉回到空間索引上,上面我們在TEST_INDEX表的GEOM欄位上建立了基於R樹[2]
空間索引IDX_TEST_INDEX_GEOM,這個空間索引的索引類型是MDSYS.SPATIAL_INDEX,這個肯定比較關鍵,下面我們看一下這個索引類型的定義:
CREATE OR REPLACE INDEXTYPE "MDSYS"."SPATIAL_INDEX" FOR
"MDSYS"."LOCATOR_WITHIN_DISTANCE" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_ANYINTERACT" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY") REWRITE JOIN,
"MDSYS"."SDO_ANYINTERACT" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_OBJECT_ARRAY"),
"MDSYS"."SDO_ANYINTERACT" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_ANYINTERACT" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_GEOMETRY"),
"MDSYS"."SDO_ANYINTERACT" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_ANYINTERACT" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_ANYINTERACT" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_CONTAINS" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_CONTAINS" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_OBJECT_ARRAY"),
"MDSYS"."SDO_CONTAINS" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_CONTAINS" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_GEOMETRY"),
"MDSYS"."SDO_CONTAINS" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_CONTAINS" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_CONTAINS" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_COVEREDBY" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_COVEREDBY" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_OBJECT_ARRAY"),
"MDSYS"."SDO_COVEREDBY" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_COVEREDBY" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_GEOMETRY"),
"MDSYS"."SDO_COVEREDBY" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_COVEREDBY" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_COVEREDBY" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_COVERS" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_COVERS" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_OBJECT_ARRAY"),
"MDSYS"."SDO_COVERS" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_COVERS" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_GEOMETRY"),
"MDSYS"."SDO_COVERS" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_COVERS" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_COVERS" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_EQUAL" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_EQUAL" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_OBJECT_ARRAY"),
"MDSYS"."SDO_EQUAL" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_EQUAL" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_GEOMETRY"),
"MDSYS"."SDO_EQUAL" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_EQUAL" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_EQUAL" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_FILTER" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY", VARCHAR2) REWRITE JOIN,
"MDSYS"."SDO_FILTER" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_OBJECT_ARRAY"),
"MDSYS"."SDO_FILTER" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_FILTER" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_GEOMETRY"),
"MDSYS"."SDO_FILTER" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_FILTER" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_FILTER" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_FILTER" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY") REWRITE JOIN,
"MDSYS"."SDO_INSIDE" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_INSIDE" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_OBJECT_ARRAY"),
"MDSYS"."SDO_INSIDE" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_INSIDE" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_GEOMETRY"),
"MDSYS"."SDO_INSIDE" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_INSIDE" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_INSIDE" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_INT2_FILTER" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_INT2_RELATE" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_INT_FILTER" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY", ROWID, VARCHAR2, VARCHAR2, VARCHAR2, NUMBER, NUMBER, NUMBER),
"MDSYS"."SDO_INT_RELATE" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY", ROWID, VARCHAR2, VARCHAR2, VARCHAR2, NUMBER, NUMBER, NUMBER),
"MDSYS"."SDO_NN" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_NN" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_NN" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_NN" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_NN" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_NN" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_NN" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_NN" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_ON" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_ON" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_OBJECT_ARRAY"),
"MDSYS"."SDO_ON" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_ON" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_GEOMETRY"),
"MDSYS"."SDO_ON" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_ON" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_ON" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_OVERLAPBDYDISJOINT" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_OVERLAPBDYDISJOINT" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_OBJECT_ARRAY"),
"MDSYS"."SDO_OVERLAPBDYDISJOINT" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_OVERLAPBDYDISJOINT" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_GEOMETRY"),
"MDSYS"."SDO_OVERLAPBDYDISJOINT" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_OVERLAPBDYDISJOINT" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_OVERLAPBDYDISJOINT" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_OVERLAPBDYINTERSECT" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_OVERLAPBDYINTERSECT" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_OBJECT_ARRAY"),
"MDSYS"."SDO_OVERLAPBDYINTERSECT" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_OVERLAPBDYINTERSECT" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_GEOMETRY"),
"MDSYS"."SDO_OVERLAPBDYINTERSECT" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_OVERLAPBDYINTERSECT" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_OVERLAPBDYINTERSECT" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_OVERLAPS" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_OVERLAPS" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_OBJECT_ARRAY"),
"MDSYS"."SDO_OVERLAPS" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_OVERLAPS" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_GEOMETRY"),
"MDSYS"."SDO_OVERLAPS" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_OVERLAPS" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_OVERLAPS" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_RELATE" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY", VARCHAR2) REWRITE JOIN,
"MDSYS"."SDO_RELATE" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_RELATE" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_RELATE" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_RTREE_FILTER" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_RTREE_RELATE" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_TOUCH" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_TOUCH" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_OBJECT_ARRAY"),
"MDSYS"."SDO_TOUCH" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_TOUCH" ("MDSYS"."SDO_TOPO_GEOMETRY", "MDSYS"."SDO_TOPO_GEOMETRY"),
"MDSYS"."SDO_TOUCH" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY"),
"MDSYS"."SDO_TOUCH" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_TOUCH" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY"),
"MDSYS"."SDO_WITHIN_DISTANCE" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."SDO_GEOMETRY", VARCHAR2) REWRITE JOIN,
"MDSYS"."SDO_WITHIN_DISTANCE" ("MDSYS"."ST_GEOMETRY", "MDSYS"."SDO_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_WITHIN_DISTANCE" ("MDSYS"."ST_GEOMETRY", "MDSYS"."ST_GEOMETRY", VARCHAR2),
"MDSYS"."SDO_WITHIN_DISTANCE" ("MDSYS"."SDO_GEOMETRY", "MDSYS"."ST_GEOMETRY", VARCHAR2)
USING "MDSYS"."SDO_INDEX_METHOD_10I"
WITH REBUILD ONLINE
WITH ORDER BY "MDSYS"."SDO_NN_DISTANCE" (NUMBER),
"MDSYS"."SDO_NN_DISTANCE" (NUMBER),
"MDSYS"."SDO_NN_DISTANCE" (NUMBER)
WITH LOCAL RANGE PARTITION
是不是翻頁翻得有點不耐煩?之所以把這個空間索引所有的內容貼上來,是想看看在Oracle Spatial中到底哪些操作支援空間索引,這裡發現一個很關鍵的問題是:為什麼沒有OGC的操作?如果在Oracle Spatial中使用一個OGC_INTERSECTS操作會有什麼後果?下面就此進行了一個測試:
首先建立一個幾何欄位為MDSYS.ST_GEOMETRY類型的空間表名為“TEST_INDEX_ST”,插入10萬條記錄,並建立空間索引:
SQL> desc test_index_st
名稱 是否為空白? 類型
----------------------------------------------------------------- -------- --------------------------------------------
GEOM MDSYS.ST_GEOMETRY
SQL> select INDEX_NAME from user_indexes where table_name='TEST_INDEX_ST';
INDEX_NAME
------------------------------------------------------------------------------------------
IDX_TEST_INDEX_ST_GEOM
SYS_IL0000079131C00009$$
SYS_IL0000079131C00008$$
如果使用上面SPATIAL_INDEX中包含的操作如SDO_ANYINTERACT,設定空間過濾條件取其中1條記錄,通過執行計畫可以發現,查詢會走空間索引:
SQL> set autot on
SQL> select * from test_index_st where SDO_ANYINTERACT(geom, ST_GEOMETRY(SDO_GEOMETRY(2001,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1,1),SDO_ORDINATE_ARRAY(10000,10000))))='TRUE';
GEOM(GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES))
------------------------------------------------------------------------------------------------------------------------
ST_GEOMETRY(SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(10000, 10000)))
經過時間: 00: 00: 00.01
執行計畫
----------------------------------------------------------
Plan hash value: 2758081403
------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1104 | 4283K| 184 (0)| 00:00:03 |
| 1 | TABLE ACCESS BY INDEX ROWID| TEST_INDEX_ST | 1104 | 4283K| 184 (0)| 00:00:03 |
|* 2 | DOMAIN INDEX | IDX_TEST_INDEX_ST_GEOM | | | | |
------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("MDSYS"."SDO_ANYINTERACT"("GEOM","ST_GEOMETRY"("MDSYS"."SDO_GEOMETRY"(2001,NULL,
NULL,"SDO_ELEM_INFO_ARRAY"(1,1,1),"SDO_ORDINATE_ARRAY"(10000,10000))))='TRUE')
但是如果是OGC_INTERSECTS操作,同樣的過濾條件,取其中的一條記錄,你會發現Oracle會進行全表掃描:
SQL> set autot on
SQL> select * from test_index_st where MDSYS.OGC_INTERSECTS(geom, ST_GEOMETRY(SDO_GEOMETRY(2001,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1,1),SDO_ORDINATE_ARRAY(10000,10000))))=1;
GEOM(GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES))
------------------------------------------------------------------------------------------------------------------------
ST_GEOMETRY(SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(10000, 10000)))
經過時間: 00: 04: 01.04
執行計畫
----------------------------------------------------------
Plan hash value: 1104487544
-----------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1104 | 4270K| 439 (3)| 00:00:06 |
|* 1 | TABLE ACCESS FULL| TEST_INDEX_ST | 1104 | 4270K| 439 (3)| 00:00:06 |
-----------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("MDSYS"."OGC_INTERSECTS"("GEOM","ST_GEOMETRY"("MDSYS"."SDO_GE
OMETRY"(2001,NULL,NULL,"SDO_ELEM_INFO_ARRAY"(1,1,1),"SDO_ORDINATE_ARRAY"(10
000,10000))))=1)
對於OGC來說,這簡直就是一個杯具。可見,有了空間索引的Oracle Spatial雖然不是斷腿的兔子,但是在OGC操作的情境下,就像把Oracle Spatial這隻兔子扔到水裡和烏龜比遊泳——而且,或許別人還不是烏龜,有可能是忍者神龜呢?
[1]
http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_5013.htm
[2]
關於不同演算法的空間索引見後續章節