[postgis-users] My slope calculation is too slow
Rémi Cura
remi.cura at gmail.com
Tue May 26 03:43:40 PDT 2015
Hey,
first, about slow query question
https://wiki.postgresql.org/wiki/Slow_Query_Questions
Now you need to identify the problem.
For this, you have mainly 2 tools :
- EXPLAIN ANALYZE (how postgres understands your query, what indexes it
uses, etc.)
- postgres stats monitoring (individual function timing)
Last, I suppose you are aware that with the view you defined, everytime you
need to access it, you need to recompute it (cache may help you depending
on the size of the result).
If it is not the expected behaviour, use MATERIAL VIEW or TABLE (possibly
TEMP or UNLOGGED ).
Cheers,
Rémi-C
2015-05-26 8:47 GMT+02:00 Ahmet Temiz <ahmettemiz88 at gmail.com>:
> hello
>
> My slope calculation is very slow.
> Can you advice me any better way to speed up slope calculation.
>
> here is the way I have used.
> -------
> Hibernate:
> CREATE VIEW vslp8 AS
> WITH r AS ( select
> ST_Transform(ST_Union(dem.rast), 32635) AS rast
> FROM
> rdem2 as dem
> where
> st_Intersects( st_transform(dem.rast, 32635) , ST_Transform(
> ST_GeomFromText('POLYGON((28.87774 40.44479446,28.87774
> 40.755545,29.4603534 40.755545,29.4603534 40.44479446,28.87774
> 40.44479446))',4326 ),32635))),
>
> cx AS (SELECT
> ST_AsRaster( sf.the_geom, r.rast) AS rast
> FROM
> ( SELECT
> ST_Transform( ST_GeomFromText('POLYGON((28.87774
> 40.44479446,28.87774 40.755545,29.4603534 40.755545,29.4603534
> 40.44479446,28.87774 40.44479446))',
> 4326 ),
> 32635) AS the_geom ) sf CROSS
> JOIN r )
> SELECT
> ST_Clip(ST_Slope(r.rast, 1, cx.rast),
> ST_Transform( ST_GeomFromText('POLYGON((28.87774
> 40.44479446,28.87774 40.755545,29.4603534 40.755545,29.4603534
> 40.44479446,28.87774 40.44479446))',
> 4326 ), 32635)) AS rast
> FROM
> r CROSS
> JOIN cx
>
> -----
>
> I will appreciate if you propose any way.
>
> regards
>
> --
> Ahmet Temiz
> Jeoloji Müh.
> Afet ve Acil Durum Yönetimi Başkanlığı
> Bilgi İşlem Dairesi Başkanlığı-CBS Grubu
>
>
> ________________________
>
> Ahmet Temiz
> Geological Eng.
> Information Systems - GIS Group
> Disaster and Emergency Management
> of Presidency
>
> _______________________________________________
> 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/20150526/4e4235dd/attachment-0001.html>
More information about the postgis-users
mailing list