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 1i2X97-0003cZ-3n for pgsql-general@arkaria.postgresql.org; Tue, 27 Aug 2019 08:48:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i2X95-0005ga-Qm for pgsql-general@arkaria.postgresql.org; Tue, 27 Aug 2019 08:48:07 +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 1i2X95-0005gT-HI for pgsql-general@lists.postgresql.org; Tue, 27 Aug 2019 08:48:07 +0000 Received: from serveurmail01.codata.be ([82.146.123.190]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i2X93-0006uC-BE for pgsql-general@lists.postgresql.org; Tue, 27 Aug 2019 08:48:06 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by serveurmail01.codata.be (Postfix) with ESMTP id 7CBE9900DE; Tue, 27 Aug 2019 10:48:04 +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 Eh2JU4sJQ6FH; Tue, 27 Aug 2019 10:48:03 +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 B1D97900DA; Tue, 27 Aug 2019 10:48:03 +0200 (CEST) Reply-To: arnaud.listes@codata.eu Subject: Re: psql \copy hanging To: Luca Ferrari Cc: pgsql-general References: <6947a518-82dd-fc26-57b3-6da5e8b89445@codata.eu> From: "Arnaud L." Message-ID: <4f450814-5697-06b1-651b-540cac0a10b0@codata.eu> Date: Tue, 27 Aug 2019 10:48:03 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: 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 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 the script automatically during working hours (to > avoid firewalling or upgrades running in parrallel to your nightly > script execution)? > Any chance something is querying the same data and a lock blocks the > transaction (pg_locks)? Hi Luca. I can run the script just fine during working hours. I checked pg_locks, and this pid is the only process requesting locks. It has around 100 of them since it is a view querying multiple tables, but I see nothing blocking. All locks are granted. I have a csv output of pg_locks so I can post this if asked. It hangs against the same line in the sql script, all lines being "\copy (select ....) to 'file on unc share'". This line is simply the longest running query because the view inside the select outputs almost 1M rows and does some subqueries. Also when the script is hung, output has not started (file size is 0). > Just throwing on the table some desperate ideas.... Desperate ideas are very welcome ! Cheers -- Arnaud