<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">Seems like everything works if i create everything in PgAdmin SQL query window and execute the query.<div>
Why is it that while using psycopg2 and python it stops somewhere in the loop? Any ideas? This might be something for the psycopg2 mailing list.</div><div><br></div><font color="#888888"><div>A.</div></font></span><br><div class="gmail_quote">
2011/10/6 Andreas Forø Tollefsen <span dir="ltr"><<a href="mailto:andreasft@gmail.com">andreasft@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><span style="font-family:arial, sans-serif;font-size:13px;background-color:rgb(255, 255, 255)"><p>Hi Andy,</p><p>There is no errors in the log. Also, the cpu load is 100 %. Looking at the pg_stat_activity show that the query is still running.<br>

The locks are also there.<br>Maybe I should reinstall everything. As i said, this query has worked before, and still do. It just stops in the loop at random steps in the loop. <br>Another thing. After I terminate the frozen query, I cannot run the script again. It just stops in the first one or two years. Restarting the server solves this. Some memory problems maybe?</p>

</span><br></div><div><div></div><div class="h5"><div class="gmail_quote">2011/10/5 Andy Colson <span dir="ltr"><<a href="mailto:andy@squeakycode.net" target="_blank">andy@squeakycode.net</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>On 10/5/2011 8:52 AM, Andreas Forř Tollefsen 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 query that previously have been running without problems.<br>
However, after installing everything from scratch it no longer work.<br>
Ubuntu 11.04, Postgresql 8.4.8, PostGIS 2.0 (7932), Geos 3.3.1, GDAL 1.8.1.<br>
<br>
The script measures distances from centroids of a vector grid to the<br>
nearest international border to a neighboring country.<br>
<br>
It uses psycopg2 module in python to loop through the years. So it<br>
inserts the distances for each year into the borddist table.<br>
<br>
However, the problem after the reinstall is that it usually loops<br>
through some years, and then everything stops. The usual processing time<br>
is ~20 minutes per year.<br>
Could this be a memory issue in postgresql.conf? Or is there a problem i<br>
am not aware of? This used to work on the previous installation, but we<br>
wanted to update the server to latest.<br>
<br>
</blockquote>
<br></div>
Can you check the PG logs and see if there are errors?  When you say everything stops, is there a postgres process still running?  Is it blocked?<br>
<br>
Have you tried:<br>
<br>
select * from pg_locks;<br>
and<br>
select * from pg_stat_activity;<br>
<br>
Is PG using CPU time?  or does it really crash?<br><font color="#888888">
<br>
-Andy<br>
</font></blockquote></div><br>
</div></div></blockquote></div><br>