Thank you,<div><br></div><div>I made :</div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">create table table_tmp as select *,</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> St_X(St_StartPoint(the_geom)) as x1,</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> St_Y(St_StartPoint(the_geom)) as y1,</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> St_X(St_EndPoint(the_geom)) as x2,</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> St_Y(St_EndPoint(the_geom)) as y2;</span> <br>from table;</div><div><br></div><div>drop table table;</div><div>alter table_tmp rename to table;</div>
<div><br></div><div>It takes 2 minutes ;)</div><div><br></div><div>Thanks !<br><br><div class="gmail_quote">On Sun, Mar 18, 2012 at 1:36 AM, Stephen Woodbridge <span dir="ltr"><<a href="mailto:woodbri@swoodbridge.com">woodbri@swoodbridge.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">On 3/17/2012 6:28 PM, Aurélien FILEZ wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
I have a table of 3.200.000 linestrings and I have to extract the start<br>
point (x1, y1) and the end point (x2, y2).<br>
<br>
So I make :<br>
UPDATE myTable SET x1 = St_X(St_StartPoint(the_geom));<br>
<br>
But the query is running since 5 hours, and still not finished.<br>
<br>
The computer is an Ubuntu Server, i3, with 4Go of RAM..<br>
<br>
Is it normal ? Is there is something to do somewhere ?<br>
</blockquote>
<br></div></div>
A couple of thoughts on this:<br>
<br>
1. yes, this is more or less normal as you have to modify every row in the table and because of row revisioning you actually have to copy every row and modify the copy.<br>
<br>
2. it probably would be faster to do something like:<br>
<br>
create table newtable as select <list of your existing columns>,<br>
  St_X(St_StartPoint(the_geom)) as x1,<br>
  St_Y(St_StartPoint(the_geom)) as y1,<br>
  St_X(St_EndPoint(the_geom)) as x2,<br>
  St_Y(St_EndPoint(the_geom)) as y2;<br>
<br>
Or if you use the update method, you should add all 4 values on the update rather than do it 4 times. And make sure you vacuum the database afterwards to recover dead space etc.<br>
<br>
3. if you are using the out of the box postgresql install it is probably not using much of your memory, and you should do some tuning. google for "postgresql tuning" and I'm sure you will get lots of links that will be helpful.<br>

<br>
-Steve<br>
______________________________<u></u>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.<u></u>refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.<u></u>net/mailman/listinfo/postgis-<u></u>users</a><br>
</blockquote></div><br></div>