<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1435168804183_3728">Hi all,</div><div id="yui_3_16_0_1_1435168804183_3931"><br></div><div dir="ltr" id="yui_3_16_0_1_1435168804183_3760">I began running this query on a table with 19,763 rows...and it is taking forever (up to 14 hours and still running). I was wondering if there was any other way to optimize this... (note: without creating edges with Topology - which is equally slow)? </div><div id="yui_3_16_0_1_1435168804183_3985" dir="ltr"><br></div><div id="yui_3_16_0_1_1435168804183_4032" dir="ltr">Thank you for your time.<br></div><div id="yui_3_16_0_1_1435168804183_4031" dir="ltr"><br></div><div id="yui_3_16_0_1_1435168804183_3973" dir="ltr">Specs:</div><div id="yui_3_16_0_1_1435168804183_3974" dir="ltr">PostgreSQL 9.2.4</div><div id="yui_3_16_0_1_1435168804183_3990" dir="ltr">PostGis 2.1.0</div><div id="yui_3_16_0_1_1435168804183_4008" dir="ltr"><br></div><div id="yui_3_16_0_1_1435168804183_4007" dir="ltr">SELECT row_number() OVER() new_id, geom <br style="" class="">INTO linestrings FROM<br style="" class="">  (SELECT <br style="" class="">    (ST_Dump(ST_Node(ST_Union(geom)))).geom geom <br style="" class="">  FROM multlinestrings) a;<br></div><div style="" class="" id="yui_3_16_0_1_1435168804183_4007" dir="ltr"><br style="" class=""></div></div></body></html>