AnsweredAssumed Answered

Why is Oracle st_geomfromwkb so slow?

Question asked by topographics on Jul 19, 2017

Hello,

here is a follow up question to Using st_geomfromwkb in PL/SQL:

 

I created a PL/SQL function that translates sdo_geometry to sde.st_geometry:

 

create or replace
function tostgeom(sdogeom in sdo_geometry)
  return sde.ST_GEOMETRY
  is
  BEGIN
    return  SDE.ST_GEOMETRY_OPERATORS.st_geomfromwkb_f(sdo_geometry.get_wkb(sdogeom), 25832);
    EXCEPTION
         WHEN OTHERS THEN
            return null;
  END;

 

I need this function because some geometries are "broken" and can't be translated to st_geometry. (Testing the sdo_geometry with sdo_util functions reveals no problem)

 

Then I call this function in SQL:

create table test as 
select id,tostgeom(GEOMETRIE) as geometrie from my_polygons
where rownum<8000;

 

The results are as expected, but the execution time ist very slow and gets slower (relatively) the more rows I include via "rownum".

 

For example:

1000 rows take 1.7 seconds

2000 rows take 3.6 seconds

4000 rows take 7.5 seconds

8000 rows take 17.5 seconds

 

As you can see, the execution "time per row" gets gradually slower for more rows.

If I use it on the full ~2 millon rows, it never finishes.

 

What could be the problem here?

I would expect the time per row to get better instead of worse for bigger datasets, beause of lesser overhead?!?

 

Thanks for any thoughts!

Outcomes