Re: psql \copy hanging

2019-10-10 Thread Adrian Klaver
On 10/10/19 12:00 AM, Arnaud L. wrote: Le 08/10/2019 à 16:59, Arnaud L. a écrit : Yes, I already did that, and unfortunately there's no activy. There is absolutely no activity in procmon using psql.exe as a filter. process-xp is not giving more information, processor usage is 0%. My

Re: psql \copy hanging

2019-10-10 Thread Arnaud L.
Le 08/10/2019 à 16:59, Arnaud L. a écrit : Yes, I already did that, and unfortunately there's no activy. There is absolutely no activity in procmon using psql.exe as a filter. process-xp is not giving more information, processor usage is 0%. My apologies, I obviously did something wrong last

Re: psql \copy hanging

2019-10-08 Thread Arnaud L.
Le 08/10/2019 à 16:55, Daniel Verite a écrit : Arnaud L. wrote: Anyway, it hung using this syntax during last night's run. I'll give it another try tonight just to be sure. When psql.exe is hanging, maybe you could use a tool like Process Monitor [1] or Process Explorer [2] to get

Re: psql \copy hanging

2019-10-08 Thread Daniel Verite
Arnaud L. wrote: > Anyway, it hung using this syntax during last night's run. > I'll give it another try tonight just to be sure. When psql.exe is hanging, maybe you could use a tool like Process Monitor [1] or Process Explorer [2] to get insights about what it's stuck on or what it's

Re: psql \copy hanging

2019-10-08 Thread Arnaud L.
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.

Re: psql \copy hanging

2019-10-08 Thread Adrian Klaver
On 10/8/19 12:06 AM, Arnaud L. wrote: Le 07/10/2019 à 16:36, Adrian Klaver a écrit : So you are saying that you have not run the problematic line by itself? It hung during last night's run. I had modified my batch script to run the \copy commands separately, i.e. it now reads as : psql -h

Re: psql \copy hanging

2019-10-08 Thread Arnaud L.
Le 08/10/2019 à 12:55, Daniel Verite a écrit : Testing this with 11.5, it works for me. Make sure you're running the latest minor release (on the client side in this case), because a related fix was issued last February. For the 11 branch it was in version 11.2. OK, my bad, backslashes in a

Re: psql \copy hanging

2019-10-08 Thread Arnaud L.
Le 08/10/2019 à 12:55, Daniel Verite a écrit : Arnaud L. wrote: As a side note, COPY (...) TO STDOUT \g 'somefile' does not work in a script file (i.e. it does not work if the command is passed in a file via the -f argument). The command runs fine, no error is raised either by the

Re: psql \copy hanging

2019-10-08 Thread Daniel Verite
Arnaud L. wrote: > As a side note, COPY (...) TO STDOUT \g 'somefile' does not work in a > script file (i.e. it does not work if the command is passed in a file > via the -f argument). > The command runs fine, no error is raised either by the client or the > server, but no file is

Re: psql \copy hanging

2019-10-08 Thread Arnaud L.
Le 08/10/2019 à 09:28, Pavel Stehule a écrit : you can write simple C application with COPY API https://www.postgresql.org/docs/12/libpq-copy.html Unfortunately, I don't know C. Then you can eliminate or ensure locality of problem. more, you can use server side copy. Superuser can read data

Re: psql \copy hanging

2019-10-08 Thread Pavel Stehule
út 8. 10. 2019 v 9:06 odesílatel Arnaud L. napsal: > Le 07/10/2019 à 16:36, Adrian Klaver a écrit : > > So you are saying that you have not run the problematic line by itself? > > It hung during last night's run. > > I had modified my batch script to run the \copy commands separately, > i.e. it

Re: psql \copy hanging

2019-10-08 Thread Arnaud L.
Le 07/10/2019 à 16:36, Adrian Klaver a écrit : So you are saying that you have not run the problematic line by itself? It hung during last night's run. I had modified my batch script to run the \copy commands separately, i.e. it now reads as : psql -h myserver -a mydb <

Re: psql \copy hanging

2019-10-07 Thread Adrian Klaver
On 10/7/19 12:41 AM, Arnaud L. wrote: Le 04/10/2019 à 19:08, Adrian Klaver a écrit : On 10/4/19 12:19 AM, Arnaud L. wrote: OK I can do that. I thought I nailed it down to this line because it started failing when this line was ~5th in the script, and it kept failing on that very same line

Re: psql \copy hanging

2019-10-07 Thread Arnaud L.
Le 07/10/2019 à 16:36, Adrian Klaver a écrit : So you are saying that you have not run the problematic line by itself? It depends what you mean by that. I've run this line by itself many times. Everytime the script has failed in fact. But until today I had not splitted the batch script to

Re: psql \copy hanging

2019-10-07 Thread Arnaud L.
Le 04/10/2019 à 19:08, Adrian Klaver a écrit : On 10/4/19 12:19 AM, Arnaud L. wrote: OK I can do that. I thought I nailed it down to this line because it started failing when this line was ~5th in the script, and it kept failing on that very same line after I moved it at the very end of the

Re: psql \copy hanging

2019-10-04 Thread Adrian Klaver
On 10/4/19 12:19 AM, Arnaud L. wrote: Le 03/10/2019 à 16:32, Adrian Klaver a écrit : I may have missed it before, but where is the Postgres server located? On the same local area network. Not on the computer running the script (so direct COPY TO is not an option). Given that this seems

Re: psql \copy hanging

2019-10-04 Thread Arnaud L.
Le 03/10/2019 à 16:32, Adrian Klaver a écrit : I may have missed it before, but where is the Postgres server located? On the same local area network. Not on the computer running the script (so direct COPY TO is not an option). Given that this seems to be some sort of resource issue and

Re: psql \copy hanging

2019-10-03 Thread Adrian Klaver
On 10/3/19 7:13 AM, Arnaud L. wrote: Le 03/10/2019 à 15:54, Adrian Klaver a écrit : On 10/2/19 11:51 PM, Arnaud L. wrote: Well, this problem is still bugging me, and this time I've tried with a local file. Unfortunately, it did not help. To further rule out filesystem problems, I first took

Re: psql \copy hanging

2019-10-03 Thread Arnaud L.
Le 03/10/2019 à 15:54, Adrian Klaver a écrit : On 10/2/19 11:51 PM, Arnaud L. wrote: Well, this problem is still bugging me, and this time I've tried with a local file. Unfortunately, it did not help. To further rule out filesystem problems, I first took care to delete the target files before

Re: psql \copy hanging

2019-10-03 Thread Adrian Klaver
On 10/2/19 11:51 PM, Arnaud L. wrote: Hi list, Le 28/08/2019 à 09:43, Luca Ferrari a écrit : I don't want to be pedantic, but I would have tried with a single change at a time. And my bet is: the local file would do the trick (i.e., it is a weird share problem). Well, this problem is still

Re: psql \copy hanging

2019-08-28 Thread Arnaud L.
Le 28/08/2019 à 09:43, Luca Ferrari a écrit : I don't want to be pedantic, but I would have tried with a single change at a time. And my bet is: the local file would do the trick (i.e., it is a weird share problem). You're not don't worry. This process is quite important in our workflow (not

Re: psql \copy hanging

2019-08-28 Thread Luca Ferrari
On Wed, Aug 28, 2019 at 9:09 AM Arnaud L. wrote: > OK, so this was enough for last night's schedule to run without problem. > I still don't get it so I'm not satisfied with this solution, but at > least it works. > I'll keep the list informed if something new arises. I don't want to be pedantic,

Re: psql \copy hanging

2019-08-28 Thread Arnaud L.
Le 27/08/2019 à 13:17, Arnaud L. a écrit : I move the offending line at the end of the script, so it will run some minutes later, maybe this will be enough. OK, so this was enough for last night's schedule to run without problem. I still don't get it so I'm not satisfied with this solution,

Re: psql \copy hanging

2019-08-27 Thread Shaozhong SHI
Interesting topic. Is there any easy way to debug, and get correct error messages? Regards, Shao On Tue, 27 Aug 2019 at 12:17, Arnaud L. wrote: > Le 27/08/2019 à 13:13, Luca Ferrari a écrit : > > My personal experience with shares and network that are not so much > > stable is that they can

Re: psql \copy hanging

2019-08-27 Thread Arnaud L.
Le 27/08/2019 à 13:13, Luca Ferrari a écrit : My personal experience with shares and network that are not so much stable is that they can block, and that is why I'm suggesting to try on the local filesystem to see if that is a share-related problem or a resource problem. Also scheduling the

Re: psql \copy hanging

2019-08-27 Thread Luca Ferrari
On Tue, Aug 27, 2019 at 12:34 PM Arnaud L. wrote: > I could do this but it would make the script a lot more complicated. > There are a lot of views that I \copy directly to this share, and this > is the only one that poses any problem. I would however give it a try. I would schedule a nightly

Re: psql \copy hanging

2019-08-27 Thread Arnaud L.
Le 27/08/2019 à 10:57, Luca Ferrari a écrit : On Tue, Aug 27, 2019 at 10:48 AM Arnaud L. wrote: I can run the script just fine during working hours. I meant thru your scheduler (cron or something). Yes, it runs fine too. There is indeed something happening on the server at this specific

Re: psql \copy hanging

2019-08-27 Thread Luca Ferrari
On Tue, Aug 27, 2019 at 10:48 AM Arnaud L. wrote: > I can run the script just fine during working hours. I meant thru your scheduler (cron or something). > It hangs against the same line in the sql script, all lines being "\copy > (select ) to 'file on unc share'". This is a new detail to

Re: psql \copy hanging

2019-08-27 Thread Arnaud L.
Le 27/08/2019 à 10:00, Luca Ferrari a écrit : On Tue, Aug 27, 2019 at 9:54 AM Arnaud L. wrote: Any other idea ? I'll change the lines order for tonight's run, but that is not what I'd call a solution... Does it hangs against the same line content or the same line number? Are you able to run

Re: psql \copy hanging

2019-08-27 Thread Arnaud L.
Le 22/08/2019 à 10:47, Arnaud L. a écrit : 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

Re: psql \copy hanging

2019-08-26 Thread Arnaud L.
Le 22/08/2019 à 16:23, Arnaud L. a écrit : Le 22/08/2019 à 16:21, Adrian Klaver a écrit : The only thing I can think of at the moment is to put the offending line in a separate script and see what happens. Then I think I'll first try to switch the line orders. I'll execute this action last

Re: psql \copy hanging

2019-08-23 Thread Arnaud L.
Le 22/08/2019 à 20:00, Jerry Sievers a écrit : 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

Re: psql \copy hanging

2019-08-22 Thread Jerry Sievers
"Arnaud L." 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 >

Re: psql \copy hanging

2019-08-22 Thread Arnaud L.
Le 22/08/2019 à 16:21, Adrian Klaver a écrit : The only thing I can think of at the moment is to put the offending line in a separate script and see what happens. Then I think I'll first try to switch the line orders. I'll execute this action last and see if it changes anything. If it

Re: psql \copy hanging

2019-08-22 Thread Adrian Klaver
On 8/22/19 7:07 AM, Arnaud L. wrote: Le 22/08/2019 à 16:00, Adrian Klaver a écrit : The first thing I think of when seeing this sort of behavior on Windows is anti-virus software. Doing you have any running on the machine? You say it always hangs on the same line. Is that line doing something

Re: psql \copy hanging

2019-08-22 Thread Arnaud L.
Le 22/08/2019 à 16:00, Adrian Klaver a écrit : The first thing I think of when seeing this sort of behavior on Windows is anti-virus software. Doing you have any running on the machine? You say it always hangs on the same line. Is that line doing something different from the others? Say writing

Re: psql \copy hanging

2019-08-22 Thread Adrian Klaver
On 8/22/19 1:47 AM, Arnaud L. wrote: 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