jueves, 19 de febrero de 2009

pg_dump y "canceling statement due to statement timeout"

Al realizar backups de tablas grandes, pueden producirse "statement timeout":

pg_dump: SQL command failed
pg_dump: Error message from server: ERROR: canceling statement due to statement timeout


Si esto sucede porque tenemos configurado "statement_timeout" a nivel general, esta configuración también está afectando las sentencias ejecutadas por pg_dump (esto sucede al menos con PostgreSql 8.1). Este se soluciona seteando la siguiente variable de entorno:

~# export PGOPTIONS="-c statement_timeout=0"
~# pg_dump test_db


También podemos hacerlo en 1 línea

~# PGOPTIONS="-c statement_timeout=0" pg_dump test_db


o también:

~# env PGOPTIONS="-c statement_timeout=0" pg_dump test_db


Tomado de: http://www.mail-archive.com/pgsql-general@postgresql.org/msg79518.html

1 comentario:

Anónimo dijo...

wow this works like a charm
thanks a bunch :)