[postgis-users] About 2-dimensional arrays of postgresql

Bborie Park dustymugs at gmail.com
Fri Sep 27 05:32:21 PDT 2013


Miguel,

Are you saying that the FOR loops are taking most of the time? What's the
time breakdown for each major step (ST_DumpValues, the FOR loop and
ST_SetValues).

The looping itself may not be the primary cause of your problem but rather
what is going on within the loop. What is going on within the loop?

-bborie


On Thu, Sep 26, 2013 at 11:25 PM, Miguel-Angel Manso-Callejo (UPM) <
m.manso at upm.es> wrote:

>  Dear all,
>
> I'm writing a stored procedure (pgplSQL) that uses postgis functions  version
> 2.1
> Dump the contents of an image on a two-dimensional array and then I update the
> cells according to some calculations.
> The process is slow, but after a while I discovered devote to the
> problem, or the slowness is due to operations that read and update the two
> -dimensional array.
>
> The code is roughly this:
>
> DECLARE
> ..
> *img** *double precision [] [];
>
> i integer j integer;
>
> BEGIN
>
>     select ST_DumpValues (rast, 1, false) INTO *img** *from ..
>
>     for i IN 1 .. 1000 LOOP
>        for j IN 1 .. 500 LOOP
>            ........
>            *img** *[i] [j]: = ..............;
>        END LOOP;
>    END LOOP;
>
>    select ST_SetValues (image, 1, 1, 1, *img*) INTO imagen2;
>    ....
> END;
>
> Anyone know why the update of the values of the two-dimensional array is
> slow?, Poorly defined array for the type of operations performed?
>
> thank you very much
> Best regards.
>
> Miguel A. Manso
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130927/5c99bdb3/attachment.html>


More information about the postgis-users mailing list