<html><body><div><p dir="ltr">Hi,</p>
<p dir="ltr">You're talking about index on attributes but did you use a gist index on your geometries?</p>
<p dir="ltr">Moreover, I'm not sure the casting is really useful but I don't know how much it costs. </p>
<p dir="ltr">HTH</p>
<p dir="ltr">Hug</p>
<div class="gmail_quote">Le 30 sept. 2015 3:50 PM, "Guillaume ARNAUD (ancienne adresse)" <guillaume.arnaud@cg82.fr> a écrit :<br type='attribution'></div><br><div><body style='font-family: Verdana,Geneva,sans-serif'>
<p>Hi all, </p>
<div class="moz-text-html" lang="x-unicode"><br /> I have a table in postgis which contains 6304 polygons.<br /> <br /> I need to make a view which union some of this polygon.<br /> <br /> I write this request :<br /> <br /> SELECT champ1, champ2, st_multi(st_union(geom))::geometry(MULTIPOLYGON, 2154) geom<br /> FROM table<br /> GROUP BY champ1, champ2, champ3, champ4, champ5<br /> <br /> The request works 36 seconds and give me the results.<br /> <br /> I have created some index on champ1 and champ2.<br /> <br /> Have you a tip to get the request faster ?<br /> <br />Thanks
<div class="moz-signature">-- <br />
<div>Guillaume ARNAUD<br /> Cellule SIGD<br /> Direction de l'Informatique<br /> Conseil Départemental de Tarn-et-Garonne </div>
</div>
</div>
<div> </div>
</div></body></html>