admin管理员组

文章数量:1025227

When running the below statement that takes more than 30 minutes (31 minutes) using psycopg2 the execution ends in the PostgreSQL server but the python routine not ends:

do $$
declare
  v_minutes int := 31;
begin

  perform pg_sleep(60 * v_minutes);

end $$;
print("start of execution")
try:
    cur  = conn.cursor()
    cur.execute(statement)
finally:
    if cur:
        cur.close()
print("end of execution")

In the PostgreSQL logs I got at 30 minutes of execution: "could not receive data from client: connection reset by peer"

If I run the statement with 29 minutes for example... it works ok.

When running the below statement that takes more than 30 minutes (31 minutes) using psycopg2 the execution ends in the PostgreSQL server but the python routine not ends:

do $$
declare
  v_minutes int := 31;
begin

  perform pg_sleep(60 * v_minutes);

end $$;
print("start of execution")
try:
    cur  = conn.cursor()
    cur.execute(statement)
finally:
    if cur:
        cur.close()
print("end of execution")

In the PostgreSQL logs I got at 30 minutes of execution: "could not receive data from client: connection reset by peer"

If I run the statement with 29 minutes for example... it works ok.

本文标签: postgresqlStatement execution not ends in PythonStack Overflow