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 1gMVZ2-0007SD-Dl for pgsql-admin@arkaria.postgresql.org; Tue, 13 Nov 2018 10:04: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 1gMVZ0-0001G0-Ms for pgsql-admin@arkaria.postgresql.org; Tue, 13 Nov 2018 10:04: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 1gMVZ0-0001Ft-FL for pgsql-admin@lists.postgresql.org; Tue, 13 Nov 2018 10:04:54 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gMVYy-00005R-S7 for pgsql-admin@postgresql.org; Tue, 13 Nov 2018 10:04:54 +0000 Received: from [192.168.127.1] (port=64061 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1gMVYw-000Ghr-3w; Tue, 13 Nov 2018 10:04:50 +0000 Received: from [127.0.0.1] (port=33018 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1gMVYv-0009XK-6C; Tue, 13 Nov 2018 10:04:49 +0000 From: Andrew Gierth To: Andrey Zhidenkov Cc: pgsql-admin@postgresql.org Subject: Re: hot_standby_feedback parameter doesn't work In-Reply-To: (Andrey Zhidenkov's message of "Tue, 13 Nov 2018 10:28:20 +0700") Message-ID: <87muqduxgt.fsf@news-spur.riddles.org.uk> References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Tue, 13 Nov 2018 10:04:48 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Andrey" == Andrey Zhidenkov writes: Andrey> We have a few database clusters (1 master, 2 hot standbys) with Andrey> hot_standby_feedback setting on. But I am constantly seeing Andrey> query conflicts on standbys because dead rows on the masters Andrey> are deleted by VACUUM. Usually I notice it shortly after VACUUM Andrey> ends, because the replication lag on replicas is starting to Andrey> increase. Feedback can only try and avoid one of the approximately five possible causes of conflicts (albeit the most common one). Next most likely is a pin conflict, especially if you have any tables involved which are both small and with a relatively high update frequency. (Unfortunately with a max delay of 0 the standby queries won't be getting cancelled which in turn means that there are no statistics about the causes of conflicts.) The most likely scenario for a pin conflict is if you have queries which are (a) long-running, and (b) contain a sequential scan of a small (one or a few blocks) table that is _not_ underneath a Hash node or similar; for example, if the Seq Scan appears as the outer path of a Nestloop join at or near the top of the plan. In this case, vacuum of the small table may block because the query is holding pin for an extended period of time on the block that vacuum wants to clean up. (It can happen with index scans too, but is less likely.) -- Andrew (irc:RhodiumToad)