Environment: Server-side SDE 10.0 Oracle 11.2, client plsql 11,oracle 11.2
For debugging convenience, the following test is to extract SQL to do on the Plsql
Demand is known as the point coordinate of a polygon, to be in a line layer, do relational intersect spatial query, the original SQL is this
Select LNO from hsline t where Sde.st_intersects (T.shape, sde.st_geometry (' Polygon ((536001.227128728 3646345.3998618745,535967.7465966925 3646245.5819230564,536081.5112751485 3646231.6260272274,536096.174854475 3646337.021285943,536096.174854475 3646337.021285943,536001.227128728 3646345.3998618745)) ', t.shape.srid)) = 1
But the query is very slow, a few minutes, the amount of data layer is tens of thousands of, theoretically should not be so slow
Later found to be the construction of geometric objects (st_geometry) caused by, if put St_geometry in a SELECT, the query speed is normal
Select LNO from hsline t where Sde.st_intersects (T.shape, (select Sde.st_geometry (' Polygon ((536001.227128728 3646345.3998618745,535967.7465966925 3646245.5819230564,536081.5112751485 3646231.6260272274,536096.174854475 3646337.021285943,536096.174854475 3646337.021285943,536001.227128728 3646345.3998618745)) ', T.shape.srid) From Hsline where rownum=1)) = 1
However, there is a flaw, in case the table hsline a row will be wrong, later colleagues out of attention, and finally made the perfect version
Select LNO from hsline t where Sde.st_intersects (T.shape, (select Sde.st_geometry (' Polygon ( 536001.227128728 3646345.3998618745,535967.7465966925 3646245.5819230564,536081.5112751485 3646231.6260272274,536096.174854475 3646337.021285943,536096.174854475 3646337.021285943,536001.227128728 3646345.3998618745)) ( T.shape.srid) dual)) = 1
Dual's explanation http://www.cnblogs.com/qiangqiang/archive/2010/10/15/1852229.html
Finally, for this slow reason, I think it is possible for each line to do where to judge when the st_geometry generated geometry is executed, and if it is placed in a sub-select, the database will only do a sub-select query, and then save the results. Main table where to judge the object directly with this
SDE st_geometry SQL st_intersects query very slow workaround