SDE st_geometry SQL st_intersects query very slow workaround

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.