<div dir="ltr"><div>Again:<br> of course the postgres postgresql.conf file is correctly configured (shared memory, working memory, etc : <a href="http://www.postgresql.org/docs/9.3/static/runtime-config-resource.html" target="_blank">http://www.postgresql.org/docs/9.3/static/runtime-config-resource.html</a>)<br>
<br></div><div>It is very well explained in the doc linked...<br></div>Cheers,<br>Rémi-C<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-18 14:28 GMT+01:00 Humberto Cereser Ibanez <span dir="ltr"><<a href="mailto:humberto@pastoraldacrianca.org.br" target="_blank">humberto@pastoraldacrianca.org.br</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Pietro,<br>
Em Ter, 2014-03-18 às 05:46 -0700, Pietro Rossin escreveu:<br>
<div><div class="h5">> Hello everybody<br>
><br>
> my query came to a result!<br>
> I followed the example by Paul Ramsey and I used a select case/else<br>
><br>
> This is the query<br>
> *******************************<br>
> SELECT sum(st_area(geom)) as areacoltura, descrizione, codice_bac,<br>
> nome, codice_cor FROM<br>
> (SELECT<br>
> a.descrizione,<br>
> b.codice_bac,<br>
> b.nome,<br>
> b.codice_cor,<br>
> CASE<br>
> WHEN ST_Within(a.geom,b.geom)<br>
> THEN a.geom<br>
> ELSE ST_Multi(ST_Intersection(a.geom,b.geom))<br>
> END AS geom<br>
> FROM varie.particellepac2006 a<br>
> JOIN idrologia.bacini_elementari b<br>
> ON a.geom && b.geom) as foo<br>
> group by descrizione, codice_bac, nome, codice_cor<br>
> *****************************<br>
><br>
> Execution time was: 3865564 ms (still really slow...)<br>
> 6922 rows result.<br>
><br>
><br>
> Explain is:<br>
> "GroupAggregate (cost=31670075.75..32322147.79 rows=20522<br>
> width=29555)"<br>
> " Output: sum(st_area(CASE WHEN ((a.geom && b.geom) AND<br>
> _st_contains(b.geom, a.geom)) THEN a.geom ELSE<br>
> st_multi(st_intersection(a.geom, b.geom)) END)), a.descrizione,<br>
> b.codice_bac, b.nome, b.codice_cor"<br>
> " -> Sort (cost=31670075.75..31673194.73 rows=1247592 width=29555)"<br>
> " Output: a.geom, b.geom, a.descrizione, b.codice_bac, b.nome,<br>
> b.codice_cor"<br>
> " Sort Key: a.descrizione, b.codice_bac, b.nome, b.codice_cor"<br>
> " -> Nested Loop (cost=0.00..5497.61 rows=1247592<br>
> width=29555)"<br>
> " Output: a.geom, b.geom, a.descrizione, b.codice_bac,<br>
> b.nome, b.codice_cor"<br>
> " -> Seq Scan on idrologia.bacini_elementari b<br>
> (cost=0.00..140.32 rows=332 width=28397)"<br>
> " Output: <a href="http://b.id" target="_blank">b.id</a>, b.geom, b.objectid, b.codice_bac,<br>
> b.nome, b.ordine, b.quota_medi, b.area_kmq, b.codice_cor"<br>
> " -> Index Scan using sidx_particellepac2006_geom on<br>
> varie.particellepac2006 a (cost=0.00..16.10 rows=3 width=1158)"<br>
> " Output: a.id_pac, a.geom, a.cod_nazion, a.foglio,<br>
> a.particella, a.sub, a.prog_polig, a.area_colt, a.cod_coltur,<br>
> a.anno_foto, a.mese_foto, a.cod_variet, a.istatp, a.stato_colt,<br>
> a.descrizione, a.shape_leng, a.shape_area"<br>
> " Index Cond: (a.geom && b.geom)"<br>
><br>
><br>
><br>
> Is there anything I can do to make it perform faster?<br>
><br>
><br>
><br>
> Is there some parameter to tune in Server Configuration?<br>
><br>
> I use Winxp32bit 4Gb ram, dual operon 252.<br>
</div></div>I suggest you take advantage of your 64bit processor.<br>
<a href="http://h18000.www1.hp.com/products/quickspecs/12357_na/12357_na.PDF" target="_blank">http://h18000.www1.hp.com/products/quickspecs/12357_na/12357_na.PDF</a><br>
My DBMS PostgreSql/PostGis runs over a Debian 64bit.<br>
><br>
><br>
> Thanks!<br>
><br>
> Pietro<br>
><br>
><br>
><br>
Good luck,<br>
<br>
Humberto Cereser Ibanez<br>
<div class="HOEnZb"><div class="h5"><br>
<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></div></div></blockquote></div><br></div>