Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fkd4W-0002O0-Kz for pgsql-general@arkaria.postgresql.org; Tue, 31 Jul 2018 22:24:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fkd4U-0004iV-5T for pgsql-general@arkaria.postgresql.org; Tue, 31 Jul 2018 22:24:50 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fkd4T-0004iK-No for pgsql-general@lists.postgresql.org; Tue, 31 Jul 2018 22:24:49 +0000 Received: from mta04.3.doruk.net.tr ([81.21.172.142] helo=mta04.doruk.net.tr) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fkd4L-0002i6-Gj for pgsql-general@postgresql.org; Tue, 31 Jul 2018 22:24:48 +0000 Received: from cmail19.webkontrol.doruk.net.tr ([212.58.6.99]) by mta04.doruk.net.tr with esmtp (Exim 4.86) (envelope-from ) id 1fkd4F-0003Ig-Mf for pgsql-general@postgresql.org; Wed, 01 Aug 2018 01:24:35 +0300 Received: from DESKTOPM80CG12 ([31.206.45.189]) by cmail19.webkontrol.doruk.net.tr (IceWarp 11.1.2.0) with ASMTP id 201808010125122642 for ; Wed, 01 Aug 2018 01:25:12 +0300 From: =?iso-8859-9?B?RXJ0YW4gS/zn/Gtv8Gx1?= To: Subject: How to prevent "no wait lock" after a connection drop Date: Wed, 1 Aug 2018 01:24:35 +0300 Message-ID: <000201d4291d$436e75d0$ca4b6170$@1nar.com.tr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-9" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdQpG5kLim2PmbuoSJygt2bVswITkw== Content-Language: tr List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, Using PostgreSQL 9.6.9 (will be PostgreSQL 10.4 in a month) running on Debian Stretch on a VPS server. =09 I am collecting customer data from distributed locations. There will be around 50-70 locations uploading data. Customer data is on local = FirebirdSQL database and there are about 15 tables synced to PostgreSQL in total. I = am using direct SSL connection to PostgreSQL to do delete/insert/update of necessary records in that order. Everything is in a single transaction = and that transaction is rolled back if anything goes wrong. Very first run of the application upload may take more than an hour depending on internet connection speed. Fast internet connections can complete relatively large initial transfer under 10 minutes. Consecutive runs are pretty fast and completes under a minute even on slow = connections. What I observe during my tests is that if I intentionally drop internet connection during any stage of data transfer (that is mostly while = inserting to tables) application gives error and stop. For next sync operation = (which runs every 5 mins) gets "no wait lock" error and exit without doing anything. That lock stage roughly stays for 1-2 hours or more. =20 I use Read Committed transaction isolation level and default action is rollback on close. I wonder if I can overcome that long lock waits as this is not desired = which will break data sync for a long period. Thanks & regards Ertan K=FC=E7=FCko=F0lu =20