Re: psql \copy hanging

From: "Arnaud L(dot)" <arnaud(dot)listes(at)codata(dot)eu>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql \copy hanging
Date: 2019-10-08 14:22:48
Message-ID: e2b59d3d-6a47-1316-f565-3d093be4644c@codata.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Le 08/10/2019 à 16:03, Adrian Klaver a écrit :
> This is going to be hard to troubleshoot if you change your commands.
>
> Previously you had:
> psql -h %MYPGSERVER% -a -f myscript.sql %MYPGDB%
>
> Changing more then one thing at a time makes it that much more difficult
> to isolate the issue.

Yes, true. Actually I do one change at a time, I'm just no posting every
single attempt. So I tried to feed the script using console redirection
rather than -f as you can see. That was the only change.

> I would create an entirely separate batch file that runs just
> problematicline.sql.

OK, that's easy.
Actually the batch file is not doing much more than running this psql
command, but that's really not a problem/

> Given that you suspect Postgres it would be helpful to see the query
> that underlies the view you are copying.
> You might want to look at autoexplain:
>
> https://www.postgresql.org/docs/11/auto-explain.html
>
> as a way of getting information at run time.

OK that's nice.
Since I don't want to mess with the whole server configuration, I added
some auto_explain settings to my script.

So for tonight, my script looks like this :

LOAD 'auto_explain';
SET auto_explain.log_min_duration = 0;
SET auto_explain.log_analyze = true;
COPY (SELECT * FROM myview) TO STDOUT \g '\\\\myserver\\myshare\\myfile.txt'

And it'll run in a separate batch.

Thanks for your help Adrian !

Regards
--
Arnaud

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2019-10-08 14:55:18 Re: psql \copy hanging
Previous Message Adrian Klaver 2019-10-08 14:03:04 Re: psql \copy hanging