<html>
<head>
<title></title>
<meta name="GENERATOR" content="MSHTML 8.00.6001.18854"></meta>
</head>
<body>Hallo
<div align="left"> </div>
<div align="left"> </div>
<div align="left">I have been struggling with the same task. I don't know if I have solved it because I ran out of time a few months ago. But I attach the sql as a file with some descriptive texts. I intend to check it more properly and write some tutorial, but that will take some time before I can do.</div>
<div align="left"> </div>
<div align="left">So, no guarantees :-)</div>
<div align="left"> </div>
<div align="left">/Nicklas<br />
<br />
2010-01-14 Nicolas Gillet - MARKET-IP wrote:<br />
<br />
></div>
<p>Hello,</p>
<p> </p>
<p> </p>
<p> </p>
<p>I have a big shape file to process (about 300 Mo, 1.5 million records)</p>
<p> </p>
<p>I have to aggregate the touching linestrings having the same attributes therefore the best way I could find (with help of this mailing list) was to aggregate all the linestrings with the same attribute and then splitting the ones that dont touch.</p>
<p> </p>
<p> </p>
<p> </p>
<p>Here is the query :</p>
<p> </p>
<p>SELECT subQ.id, subQ.feattyp, subQ.frc, subQ.shieldnum, subQ.name, null, (st_dump(merged_geom)).geom AS the_geom</p>
<p> </p>
<p>FROM (</p>
<p> </p>
<p> SELECT MAX(id) AS id, feattyp, frc, MAX(shieldnum) AS shieldnum, nw.name, ST_LineMerge(ST_Collect(the_geom)) AS merged_geom</p>
<p> </p>
<p> FROM nw</p>
<p> </p>
<p> WHERE nw.frc >= 0</p>
<p> </p>
<p> GROUP BY nw.name, nw.feattyp, nw.frc</p>
<p> </p>
<p>) AS subQ;</p>
<p> </p>
<p> </p>
<p> </p>
<p>This has worked fine on smaller shapes but on this one I get an out of memory error.</p>
<p> </p>
<p> </p>
<p> </p>
<p>I used pgTune to change database default settings and the result is as follow :</p>
<p> </p>
<p> </p>
<p> </p>
<p>#custom_variable_classes = '' # list of custom variable class names</p>
<p> </p>
<p>default_statistics_target = 50 # pgtune wizard 2010-01-13</p>
<p> </p>
<p>maintenance_work_mem = 120MB # pgtune wizard 2010-01-13</p>
<p> </p>
<p>constraint_exclusion = on # pgtune wizard 2010-01-13</p>
<p> </p>
<p>effective_cache_size = 1408MB # pgtune wizard 2010-01-13</p>
<p> </p>
<p>work_mem = 12MB # pgtune wizard 2010-01-13</p>
<p> </p>
<p>wal_buffers = 8MB # pgtune wizard 2010-01-13</p>
<p> </p>
<p>checkpoint_segments = 16 # pgtune wizard 2010-01-13</p>
<p> </p>
<p>shared_buffers = 480MB # pgtune wizard 2010-01-13</p>
<p> </p>
<p>max_connections = 80 # pgtune wizard 2010-01-13</p>
<p> </p>
<p> </p>
<p> </p>
<p>All the other parameters have their default values.</p>
<p> </p>
<p> </p>
<p> </p>
<p>What can I do to run my script through this heavy shape files ?</p>
<p> </p>
<p> </p>
<p> </p>
<p>Thank you</p>
<p> </p>
<p> </p>
<p> </p>
<p>Nicolas.</p>
<p> </p>
</body>
</html>