[postgis-devel] [PostGIS] #310: port ST_DumpPoints() to C

PostGIS trac at osgeo.org
Tue Feb 15 14:01:17 PST 2011


#310: port ST_DumpPoints() to C
-------------------------+--------------------------------------------------
 Reporter:  kneufeld     |       Owner:  pramsey       
     Type:  enhancement  |      Status:  new           
 Priority:  low          |   Milestone:  PostGIS Future
Component:  postgis      |     Version:  trunk         
 Keywords:               |  
-------------------------+--------------------------------------------------
Changes (by bitner):

 * cc: bitner (added)


Comment:

 Hacky test that shows potential performance gain by getting away from the
 plpgsql looping structure with npoints. Dumping a 2600 point linestring
 takes almost a second with st_dumppoints and ~30ms with this function.

 CREATE OR REPLACE FUNCTION dump_linestring_points(geometry)
 RETURNS SETOF geometry AS
 $BODY$
 SELECT
         (
         'SRID=' ||
         bar ||
         ';POINT(' ||
         foo ||
         ')'
         )::geometry
 FROM
         regexp_split_to_table(
                 rtrim(
                         substring(asewkt($1) from 23)
                         ,')'
                 ),
                 ','
         ) as foo , srid($1) as bar
 WHERE st_geometrytype($1)='ST_LineString';
 $BODY$
 LANGUAGE sql IMMUTABLE STRICT
 COST 1
 ROWS 100;

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/310#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list