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 1i0rOL-0000K5-5S for pgsql-general@arkaria.postgresql.org; Thu, 22 Aug 2019 18:00:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i0rOK-0002Yd-0K for pgsql-general@arkaria.postgresql.org; Thu, 22 Aug 2019 18:00:56 +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 1i0rOJ-0002UM-5i for pgsql-general@lists.postgresql.org; Thu, 22 Aug 2019 18:00:55 +0000 Received: from resqmta-ch2-07v.sys.comcast.net ([2001:558:fe21:29:69:252:207:39]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i0rOF-0005ri-Li for pgsql-general@postgresql.org; Thu, 22 Aug 2019 18:00:54 +0000 Received: from resomta-ch2-19v.sys.comcast.net ([69.252.207.115]) by resqmta-ch2-07v.sys.comcast.net with ESMTP id 0rAYirD1kGZBb0rOBikwgU; Thu, 22 Aug 2019 18:00:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=20190202a; t=1566496847; bh=2eZngvw3fWW3hRMaTy1vCE+bmYSiq8gmL4P/Fd41G6U=; h=Received:Received:Received:From:To:Subject:Date:Message-ID: MIME-Version:Content-Type; b=pCMCvwKsf3r6p4mC+aRuZeqe9CiDyy9SyLq748MYrRb6lCnA4eoJJZdeBvPUrVKDM Xd3WHtCLnbO01He8QVIVYS8FzODtrwvkvp54cPORoHwjWTq4YZSzoZEc609vQt/8Hv iNIiZ/vxyahhXMbSTT0ogIFR0n1obXgb0CUGKJIRCC1gq4jh8g3L5lFolBRUd2Kwg7 7aefw6jDZ2DVubJBbgmBXjD9HN+zm0RvVsp2wthUY/BZkgZmn15/0ZVeTryPGn1a6t /pN3mNyKuSSkoGggpErGCHGuStmZHynvXghEEaHonCUeSym2kO9sXy3ZlaH26UM7ai x568kvhJtOC8w== Received: from jsievers.comcast.net ([12.30.159.20]) by resomta-ch2-19v.sys.comcast.net with ESMTPA id 0rO2i4xWBdZp70rO3iRZ55; Thu, 22 Aug 2019 18:00:45 +0000 X-Xfinity-VAAS: gggruggvucftvghtrhhoucdtuddrgeduvddrudegiedgjeejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuvehomhgtrghsthdqtfgvshhipdfqfgfvpdfpqffurfetoffkrfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfgvrhhrhicuufhivghvvghrshcuoehgshhivghvvghrshduleestghomhgtrghsthdrnhgvtheqnecukfhppeduvddrfedtrdduheelrddvtdenucfrrghrrghmpehhvghlohepjhhsihgvvhgvrhhsrdgtohhmtggrshhtrdhnvghtpdhinhgvthepuddvrdeftddrudehledrvddtpdhmrghilhhfrhhomhepghhsihgvvhgvrhhsudelsegtohhmtggrshhtrdhnvghtpdhrtghpthhtoheprghrnhgruhgurdhlihhsthgvshestghouggrthgrrdgvuhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehpohhsthhgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-Xfinity-VMeta: sc=0;st=legit Received: from jsievers.enova.com (localhost [127.0.0.1]) by jsievers.comcast.net (Postfix) with ESMTP id 69B8426005A; Thu, 22 Aug 2019 13:00:38 -0500 (CDT) From: Jerry Sievers To: "Arnaud L." Cc: pgsql-general@postgresql.org Subject: Re: psql \copy hanging References: Date: Thu, 22 Aug 2019 13:00:38 -0500 In-Reply-To: (Arnaud L.'s message of "Thu, 22 Aug 2019 10:47:22 +0200") Message-ID: <87ef1dkrll.fsf@jsievers.enova.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "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 > '\\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.consulting@comcast.net