Oracle Spatial SDO_CS.Transform (value) function is very slow

I have a custom view that retrieves spatial data from columns of geometry and retrieves latitude / longitude values. However, the search process is very slow and takes 5 to 10 minutes to obtain view data.

Here is my view:

CREATE OR REPLACE FORCE VIEW PoleData
(
   G3E_FID,
   X_COORD,
   Y_COORD,
   LATITUDE,
   LONGITUDE
)
AS
   SELECT P.g3e_fid,
          T2.X * 1000 AS x_coord,
          T2.Y * 1000 AS y_coord,
          T.Y AS latitude,
          T.X AS longitude
     FROM PolePoint P,
          TABLE (
             SDO_UTIL.GETVERTICES (SDO_CS.TRANSFORM (P.G3E_GEOMETRY, 8265))) T,
          TABLE (SDO_UTIL.GETVERTICES (P.G3E_GEOMETRY)) T2
    WHERE P.ltt_id = 0
   UNION
   SELECT P.g3e_fid,
          T2.X * 1000 AS x_coord,
          T2.Y * 1000 AS y_coord,
          T.Y AS latitude,
          T.X AS longitude
     FROM PoleDetailPoint P,
          TABLE (
             SDO_UTIL.GETVERTICES (SDO_CS.TRANSFORM (P.G3E_GEOMETRY, 8265))) T,
          TABLE (SDO_UTIL.GETVERTICES (P.G3E_GEOMETRY)) T2
    WHERE P.ltt_id = 0;

The column G3E_GEOMETRYis of type SDO_GEOMETRY. The PolePoint table has 1310 629 rows, and the PoleDetailPoint table has 100. The data in these tables is updated daily and the view is used for reporting purposes.

I tried rebuilding the spatial index using a parameter status=cleanup. But that didn't make any difference.

Our version is Oracle 11.2.0.3.

/. , ?

+4
2

UNION ALL UNION:

SELECT P.g3e_fid,
       T2.X * 1000 AS x_coord,
       T2.Y * 1000 AS y_coord,
       T.Y AS latitude,
       T.X AS longitude
  FROM PolePoint P,
       TABLE (
          SDO_UTIL.GETVERTICES (SDO_CS.TRANSFORM (P.G3E_GEOMETRY, 8265))) T,
       TABLE (SDO_UTIL.GETVERTICES (P.G3E_GEOMETRY)) T2
 WHERE P.ltt_id = 0
UNION ALL
SELECT P.g3e_fid,
       T2.X * 1000 AS x_coord,
       T2.Y * 1000 AS y_coord,
       T.Y AS latitude,
       T.X AS longitude
  FROM PoleDetailPoint P,
       TABLE (
          SDO_UTIL.GETVERTICES (SDO_CS.TRANSFORM (P.G3E_GEOMETRY, 8265))) T,
       TABLE (SDO_UTIL.GETVERTICES (P.G3E_GEOMETRY)) T2
 WHERE P.ltt_id = 0;

, SDO_UTIL.GET_VERTICES P.G3E_GEOMETRY, P.G3E_GEOMETRY, , , , , P.G3E_GEOMETRY 5 , 5 * 5 25 T T2 5 P.G3E_GEOMETRY. , SDO_CS.TRANSFORM, , , and t1.id = t2.id :

SELECT P.g3e_fid,
       T2.X * 1000 AS x_coord,
       T2.Y * 1000 AS y_coord,
       T.Y AS latitude,
       T.X AS longitude
  FROM PolePoint P,
       TABLE (
          SDO_UTIL.GETVERTICES (SDO_CS.TRANSFORM (P.G3E_GEOMETRY, 8265))) T,
       TABLE (SDO_UTIL.GETVERTICES (P.G3E_GEOMETRY)) T2
 WHERE P.ltt_id = 0
   AND T.ID = T2.ID
UNION ALL
SELECT P.g3e_fid,
       T2.X * 1000 AS x_coord,
       T2.Y * 1000 AS y_coord,
       T.Y AS latitude,
       T.X AS longitude
  FROM PoleDetailPoint P,
       TABLE (
          SDO_UTIL.GETVERTICES (SDO_CS.TRANSFORM (P.G3E_GEOMETRY, 8265))) T,
       TABLE (SDO_UTIL.GETVERTICES (P.G3E_GEOMETRY)) T2
 WHERE P.ltt_id = 0
   AND T.ID = T2.ID;
+1

cast with?

, ( , )

:

with t as (select * from table (sdo_util.getvertices (sdo_cs.transform (p.g3e_geometry, 8265)))),
     t2 as (select * from table (sdo_util.getvertices (p.g3e_geometry)))
select p.g3e_fid,
       t2.x * 1000 as x_coord,
       t2.y * 1000 as y_coord,
       t.y as latitude,
       t.x as longitude
  from polepoint p, t, t2
 where p.ltt_id = 0
union 
select p.g3e_fid,
       t2.x * 1000 as x_coord,
       t2.y * 1000 as y_coord,
       t.y as latitude,
       t.x as longitude
  from poledetailpoint p, t, t2
 where p.ltt_id = 0;

, , "union" ( ) "union all"? (.. ? union all)

-1

Source: https://habr.com/ru/post/1605850/


All Articles