<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">G'day Vincent,<div><br></div><div>This didn't work as anticipated - in fact it appears to have truncated the table!<br><div><br><div><div>On 08/01/2009, at 5:01 AM, <a href="mailto:postgis-users-request@postgis.refractions.net">postgis-users-request@postgis.refractions.net</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; ">Another and more <classic> solution (despite slower on big tables) to<br>keep spatially close rows together on disk is to use postgresql CLUSTER<br>statement.<br><a href="http://www.postgresql.org/docs/8.3/static/sql-cluster.html">http://www.postgresql.org/docs/8.3/static/sql-cluster.html</a><br><br>CLUSTER reorders data on disk using a specified index, therefore<br>increasing access speed when reading rows in the index order.<br><br>Example :<br>CREATE INDEX idx_mytable_the_geom ON mytable USING GIST(the_geom);<br>CLUSTER mytable USING idx_mytable_the_geom;<br></span></blockquote></div><div><br></div><div>CLUSTER works on a normal index :</div><div><br></div><div><div># select count(*) from gis_roads;</div><div> count </div><div>-------</div><div> 89618</div><div>(1 row)</div><div><br></div><div># CLUSTER gis_roads USING gis_roads_gid_key;</div><div><br></div><div>CLUSTER</div><div># select count(*) from gis_roads;</div><div> count </div><div>-------</div><div> 89618</div><div>(1 row)</div><div><br></div><div>all good!</div><div><br></div><div>But when I try on the gist index </div><div><br></div><div><br></div><div># CLUSTER gis_roads USING gis_roads_gist;</div><div>CLUSTER</div><div><br></div><div># select count(*) from gis_roads;</div><div> count </div><div>-------</div><div>     0</div><div>(1 row)</div><div><br></div></div><div>whoops!</div><div><br></div><div>Is this something I missed? Is this a PostgreSQL bug... surely the cluster command shouldn't be allowed to destroy a whole table.</div><div><br></div><div>cheers</div><div><br></div><div>Ben</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-- </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Ben Madin</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">REMOTE INFORMATION</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">t : +61 8 9192 5455</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">f : +61 8 9192 5535</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">m : 0448 887 220</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Broome   WA   6725</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><a href="mailto:ben@remoteinformation.com.au">ben@remoteinformation.com.au</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="white-space: pre; ">                                                   </span></span>Out here, it pays to know...</div></div><br class="Apple-interchange-newline"></span> </div><br></div></div></body></html>