Re: psql \copy hanging

From: Jerry Sievers <gsievers19(at)comcast(dot)net>
To: "Arnaud L(dot)" <arnaud(dot)listes(at)codata(dot)eu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: psql \copy hanging
Date: 2019-08-22 18:00:38
Message-ID: 87ef1dkrll.fsf@jsievers.enova.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Arnaud L." <arnaud(dot)listes(at)codata(dot)eu> writes:

> Hi list
>
> On Windows, I have an unattended script that exports data overnight by
> issuing psql commands like :
> psql -f mycommands.sql
> whith mycommands.sql containing a bunch of \copy lines like :
> \copy (SELECT * FROM someview) TO
> '\\windowsserver\windowsshare\somefile.csv'
>
> When I run this script by hand, everything is fine but when it runs
> overnight it hangs and allways on the same line.

Is the overnight run being done as the same DB user you are testing
with?

If not, then perhaps the automated user deviates in resource settings
and/or permissions, in turn resulting in sluggish performance caused by
thrashing and/or inferior query plan.

> There is no lock in the database, and the connection is marked as
> active in the backend and running the statement "COPY (SELECT * FROM
> myview) TO STDOUT".
> So where can things be hanging ?
> My first guess (appart from db lock) was that the target file was
> locked by the filesystem. But wouldn't psql know about it and fail
> with an error ?
>
> Thanks for your help !
>
> --
> Arnaud
>
>
>

--
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres(dot)consulting(at)comcast(dot)net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Igal @ Lucee.org 2019-08-22 18:29:44 How to install Postgres 12 beta with YUM
Previous Message Igal @ Lucee.org 2019-08-22 17:56:59 How to install Postgres 12 beta with YUM