<div dir="ltr"><div class="gmail_default" style="font-size:small">thank you ( Rémi ),</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Good support. I had never known "<span style="font-family:monospace,monospace;font-size:12.800000190734863px">MATERIAL VIEW".</span></div><div class="gmail_default" style="font-size:small"><span style="font-family:monospace,monospace;font-size:12.800000190734863px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-family:monospace,monospace;font-size:12.800000190734863px">regards</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 26, 2015 at 1:43 PM, Rémi Cura <span dir="ltr"><<a href="mailto:remi.cura@gmail.com" target="_blank">remi.cura@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">Hey,</div><div class="gmail_default" style="font-family:monospace,monospace">​​</div><div class="gmail_default" style="font-family:monospace,monospace">first, about slow query question</div><div class="gmail_default"><font face="monospace, monospace"><a href="https://wiki.postgresql.org/wiki/Slow_Query_Questions" target="_blank">https://wiki.postgresql.org/wiki/Slow_Query_Questions</a></font><br></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">Now you need to identify the problem.<br>For this, you have mainly 2 tools : </font></div><div class="gmail_default"><font face="monospace, monospace"> - EXPLAIN ANALYZE (how postgres understands your query, what indexes it uses, etc.)</font></div><div class="gmail_default"><font face="monospace, monospace"> - postgres stats monitoring (individual function timing)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">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).<br>If it is not the expected behaviour, use MATERIAL VIEW or TABLE (possibly TEMP or</font> UNLOGGED <span style="font-family:monospace,monospace">).</span><br></div><div class="gmail_default"><span style="font-family:monospace,monospace"><br></span></div><div class="gmail_default"><span style="font-family:monospace,monospace"><br></span></div><div class="gmail_default"><font face="monospace, monospace">Cheers,</font></div><div class="gmail_default"><font face="monospace, monospace">Rémi-C</font></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">2015-05-26 8:47 GMT+02:00 Ahmet Temiz <span dir="ltr"><<a href="mailto:ahmettemiz88@gmail.com" target="_blank">ahmettemiz88@gmail.com</a>></span>:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div style="font-size:small">hello</div><div style="font-size:small"><br></div><div style="font-size:small">My slope calculation is very slow.<br></div><div style="font-size:small">Can you advice me any better way to speed up slope calculation.</div><div style="font-size:small"><br></div><div style="font-size:small">here is the way I have used. </div><div style="font-size:small">-------</div><div><div>Hibernate: </div><div>     CREATE VIEW vslp8 AS </div><div>    WITH r AS (  select</div><div>         ST_Transform(ST_Union(dem.rast),  32635) AS rast   </div><div>     FROM</div><div>         rdem2 as dem  </div><div>     where</div><div>         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))),</div><div><br></div><div>cx AS (SELECT</div><div>         ST_AsRaster( sf.the_geom,  r.rast) AS rast </div><div>     FROM</div><div>         ( SELECT</div><div>             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))',</div><div>             4326 ),</div><div>             32635) AS the_geom ) sf CROSS </div><div>     JOIN r ) </div><div> SELECT</div><div>             ST_Clip(ST_Slope(r.rast, 1,  cx.rast),</div><div>             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))',</div><div>             4326 ),  32635)) AS rast  </div><div>         FROM</div><div>             r  CROSS </div><div>         JOIN cx </div><div><br></div><div>-----</div><div><br></div><div>I will appreciate if you propose any way.</div><div><br></div><div>regards</div></div><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div>Ahmet Temiz<br>Jeoloji Müh.<br>Afet ve Acil Durum Yönetimi Başkanlığı<br>Bilgi İşlem  Dairesi Başkanlığı-CBS Grubu<br><br><br>________________________<span><font color="#888888"><br><br>Ahmet Temiz<br>Geological Eng.<br>Information Systems - GIS Group<br>Disaster and Emergency Management<br>of Presidency</font></span></div></div></div></div></div>
</div>
<br></div></div>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Ahmet Temiz<br>Jeoloji Müh.<br>Afet ve Acil Durum Yönetimi Başkanlığı<br>Bilgi İşlem  Dairesi Başkanlığı-CBS Grubu<br><br><br>________________________<br><br>Ahmet Temiz<br>Geological Eng.<br>Information Systems - GIS Group<br>Disaster and Emergency Management<br>of Presidency</div></div></div></div></div>
</div>