Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHqO8-0006Jt-4M for pgsql-general@arkaria.postgresql.org; Tue, 08 Oct 2019 14:22:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iHqO6-00081W-33 for pgsql-general@arkaria.postgresql.org; Tue, 08 Oct 2019 14:22:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHqO5-00081M-Pb for pgsql-general@lists.postgresql.org; Tue, 08 Oct 2019 14:22:53 +0000 Received: from serveurmail01.codata.be ([82.146.123.190]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iHqO2-00059J-Pg for pgsql-general@postgresql.org; Tue, 08 Oct 2019 14:22:53 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by serveurmail01.codata.be (Postfix) with ESMTP id 58FFC900C9; Tue, 8 Oct 2019 16:22:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at serveurmail01.codata.be Received: from serveurmail01.codata.be ([127.0.0.1]) by localhost (serveurmail01.codata.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dotcm-AlTOxq; Tue, 8 Oct 2019 16:22:49 +0200 (CEST) Received: from [10.0.0.100] (38-179-112-217.fix.adsl.belcenter.be [217.112.179.38]) by serveurmail01.codata.be (Postfix) with ESMTPSA id 5EB27900B5; Tue, 8 Oct 2019 16:22:49 +0200 (CEST) Reply-To: arnaud.listes@codata.eu Subject: Re: psql \copy hanging To: Adrian Klaver , pgsql-general References: <9e9164df-e7b7-bcd3-538a-7714907f7df4@aklaver.com> <171491de-b8e1-7f0d-0724-4d06a7902cc0@codata.eu> <291938b2-5816-5858-065f-e85387def0eb@aklaver.com> <230d9c65-450f-b97c-7ef0-c8e9a85103f6@codata.eu> <8f921914-178e-b520-7f93-dab80ea02555@aklaver.com> <5612153a-af11-38da-c34e-8b4bab9cfc8e@aklaver.com> From: "Arnaud L." Message-ID: Date: Tue, 8 Oct 2019 16:22:48 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <5612153a-af11-38da-c34e-8b4bab9cfc8e@aklaver.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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