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 1iG29c-0005Iz-Un for pgsql-general@arkaria.postgresql.org; Thu, 03 Oct 2019 14:32:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iG29b-0001LC-Lm for pgsql-general@arkaria.postgresql.org; Thu, 03 Oct 2019 14:32:27 +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 1iG29a-0001Kn-1g for pgsql-general@lists.postgresql.org; Thu, 03 Oct 2019 14:32:27 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iG29V-0006F7-Nn for pgsql-general@postgresql.org; Thu, 03 Oct 2019 14:32:25 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id A601821C7A; Thu, 3 Oct 2019 10:32:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 03 Oct 2019 10:32:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=b koIJAJx86KBa4amAyNiW+N75wP+yePZIDW/qZuZNT4=; b=OUWUcGOdc8I234cKQ IlNglKEIISGS2EDwZab2bPfyfy34N/RjT5CDPCSKYxE1EN0P+xUtWLndDExwCiiC g5eLgka2pC1oMDPL6jRQAlmwkXxJ1bA0/nIG04Fa/neWgH0hnZKXFwg2Pn8SAxz6 SJ7sXoSuj3v2ieSewpxxcl+/1LzQH/kJpLLZ+faaPgz4R55pgSSSdTD4PjTJpsOP lFGilkVVZgkJqzOXp7+KGzxDM5gvMNEMAvpO61cMT+QfbF2by89pmdlsHdZYOSG0 8mJOxcbotawdytoepalFBtwma2oBMdXa4WNHlocfS7vGcL6XYmI3SIQInXBOBl63 pQOZQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=bkoIJAJx86KBa4amAyNiW+N75wP+yePZIDW/qZuZN T4=; b=k/Kbi02rN/4CGs1i2D6f8JoJGs4G2S4IzkaNYE7soeRgS7nsVsA8sfRUV 2vhPziHT99Ct9JK+e+OMPtKaWqusmRVt0hmcV3yr4MXzhRcwVOXn6C+pYTakiTmA PstCPkjQc8LjsmSejxC3AMR3HilqX1rExki5O8+FRcD3WfH6+IjkWDkrP8XHsbUd Hz4J9jWrnrjet2YWpZs80viDdRymx+Ab7aQJ1erwRBVG2VyTDgLvLtpWtdcUhlmZ LD92NQ6SQ1RYLdpnlbUtoQ+qFoNnoEgQ/x74ESTa55/sztG19Pg3/6pBAi7QqjIz mKZS/jeQWe9jFjfWjeMnm/S1d3x8A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrgeekgdejkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthekre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucfkphepudejgedrvddurdejtddrieegne curfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghv vghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.3] (174-21-70-64.tukw.qwest.net [174.21.70.64]) by mail.messagingengine.com (Postfix) with ESMTPA id 8A6F6D60066; Thu, 3 Oct 2019 10:32:18 -0400 (EDT) Subject: Re: psql \copy hanging To: arnaud.listes@codata.eu, pgsql-general References: <9e9164df-e7b7-bcd3-538a-7714907f7df4@aklaver.com> <171491de-b8e1-7f0d-0724-4d06a7902cc0@codata.eu> From: Adrian Klaver Message-ID: <291938b2-5816-5858-065f-e85387def0eb@aklaver.com> Date: Thu, 3 Oct 2019 07:32:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <171491de-b8e1-7f0d-0724-4d06a7902cc0@codata.eu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 care to delete >>> the target files before copying to it, but it did not help either. >>> >>> So now I'm quite confident that the problem is either psql or even >>> postgresql itself. >>> >>> Does anyone know of anything I could try to try to fix or debug this ? >> >> Going back to the original thread I noticed it was not specified what >> program was being used to run the script in the overnight session. >> >> So what is being used to run the script overnight? > > > Yes, sorry for having lost the original thread, my mailbox has a quite > stupid automatic purge schedule... > > The script is run in a windows batch file. > Basically, export.bat contains : > > SET PGUSER=myuser > SET PGPASSWORD=mypwd > SET PGCLIENTENCODING=UTF8 > SET MYPGSERVER=myserverurl > SET MYPGDB=mydatabase > psql -h %MYPGSERVER% -a -f myscript.sql %MYPGDB% I may have missed it before, but where is the Postgres server located? Given that this seems to be some sort of resource issue and that the below contains commands that are not dependent on each other, have you thought of splitting myscript.sql into two scripts? If nothing else the n(total line)-problem line in one script and the problem line in another. That would help nail down whether that line is truly the problem or if it is an interaction with running the other 50+ lines. > > And myscript.sql contains : > \copy (SELECT * FROM view1) TO '\\server\share\view1.txt' > \copy (SELECT * FROM view2) TO '\\server\share\view2.txt' > ... > etc with ~60 views > > Today, I've update the problematic \copy line to be : > COPY (SELECT * FROM view) TO STDOUT \g '\\server\share\view.txt' > > I'll keep you informed (even though a successfull run is not a guarantee > of success, because the original script did sometimes work). > > Regards > -- > Arnaud > -- Adrian Klaver adrian.klaver@aklaver.com