Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Va4fM-0003hH-83 for pgsql-performance@arkaria.postgresql.org; Sat, 26 Oct 2013 14:16:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Va4fL-0002LZ-1h for pgsql-performance@arkaria.postgresql.org; Sat, 26 Oct 2013 14:16:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Va4fK-0002LT-9w for pgsql-performance@postgresql.org; Sat, 26 Oct 2013 14:16:34 +0000 Received: from mail.gransy.com ([2001:1528:137::f1]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Va4fD-0003cs-Mi for pgsql-performance@postgresql.org; Sat, 26 Oct 2013 14:16:34 +0000 Received: from antispam.gransy.com (antispam.gransy.com [77.78.104.124]) by mail.gransy.com (Postfix) with ESMTP id 69641508C39 for ; Sat, 26 Oct 2013 16:16:27 +0200 (CEST) X-Virus-Scanned: G-Hosting.cz + Station.cz + Klenot.cz + Subreg.cz amavisd-new at antispam.gransy.com Received: from mail.gransy.com ([82.208.44.189]) by antispam.gransy.com (antispam.gransy.com [77.78.104.124]) (amavisd-new, port 10024) with ESMTP id cmrlZdBp5qn8 for ; Sat, 26 Oct 2013 16:16:36 +0200 (CEST) Received: by mail.gransy.com (Postfix, from userid 5000) id 3A7C5508C4B; Sat, 26 Oct 2013 16:16:27 +0200 (CEST) Received: from [192.168.1.227] (ip-78-45-139-138.net.upcbroadband.cz [78.45.139.138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.gransy.com (Postfix) with ESMTPSA id 0B31E508C39 for ; Sat, 26 Oct 2013 16:16:27 +0200 (CEST) Message-ID: <526BCEBA.3010102@fuzzy.cz> Date: Sat, 26 Oct 2013 16:16:26 +0200 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Hot Standby performance issue References: <52658780.1040002@fuzzy.cz> <1382390332002-5775332.post@n5.nabble.com> <5265A28E.4060601@fuzzy.cz> <1382396377294-5775349.post@n5.nabble.com> <5265B562.3040407@fuzzy.cz> <1382400045239-5775361.post@n5.nabble.com> <5266BD42.2030303@fuzzy.cz> <1382478627757-5775529.post@n5.nabble.com> <52670702.3030201@fuzzy.cz> <1382491400068-5775550.post@n5.nabble.com> <1382736171070-5775972.post@n5.nabble.com> In-Reply-To: <1382736171070-5775972.post@n5.nabble.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 25.10.2013 23:22, ramistuni wrote: > Today morning I found that the performance issue on standby database > was fixed by itself. On further investigation I found that one of the > biggest used in this query had autovacuum kicked in yesterday on > primary. The last time it had autovaccum ran was on Sep 30th. > > I am suspecting that this should have been fixed the issue. The table > has update and delete operations. Only thing I did not understand why > postgres did not pick this table for autovacuum all these days, in > spite of this table is one of the busiest table from DML perspective. > I was monitoring the primary database activity all these days and > always could see autovacuum was running on another tables. Hi, I don't see how this would explain the issues you've reported, i.e. query running fast on primary and very slow on standby. That suggests the problem is somehow connected to the replication conflict resolution. However I don't see a reason why a query should take so much longer before failing due to a conflict. To find out why the autovacuum didn't trigger on the largest/busiest table, you should probably check your logs for autovacuum failures and/or cancels. Then we'll need to know the basic features of the table (most importantly how many rows are there), and autovacuum thresholds. It's possible that the table is simply way bigger than the other tables, and thus it takes more time to accumulate enough "dead rows" to trigger autovacuum. Or maybe most of the cleanup tasks was handled by HOT, i.e. not requiring a vacuum at all. I think you need to check these fields in pg_stat_all_tables SELECT n_live_tup, n_dead_tup, n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd FROM pg_stat_all_tables WHERE relname = '... tablename ...' regards Tomas -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance