Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgNUv-0003Z5-3b for pgsql-general@arkaria.postgresql.org; Wed, 03 Jun 2020 07:07:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jgNUt-0002Qm-Sd for pgsql-general@arkaria.postgresql.org; Wed, 03 Jun 2020 07:07:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgNUt-0002Qf-KT for pgsql-general@lists.postgresql.org; Wed, 03 Jun 2020 07:07:35 +0000 Received: from portal-smtp-out.hot.ee ([194.126.101.125]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgNUm-0000du-B2 for pgsql-general@postgresql.org; Wed, 03 Jun 2020 07:07:34 +0000 Received: from localhost (localhost [127.0.0.1]) by vm-hot-relay10.estpak.ee (Postfix) with ESMTP id 049C61D51 for ; Wed, 3 Jun 2020 10:07:24 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at vm-hot-relay10.estpak.ee Received: from portal-smtp-out.hot.ee ([127.0.0.1]) by localhost (vm-hot-relay10.estpak.ee [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7FSuz5PViCcg for ; Wed, 3 Jun 2020 10:07:21 +0300 (EEST) Received: from mail.hot.ee (hot-relayhost3.estpak.ee [213.180.2.81]) by vm-hot-relay10.estpak.ee (Postfix) with ESMTP id C2A2A1D4E for ; Wed, 3 Jun 2020 10:07:21 +0300 (EEST) Received: from dell2 (66-63-196-88.sta.estpak.ee [88.196.63.66]) (Authenticated sender: kobruleht2) by HOT-Relayhost3.estpak.ee (Postfix) with ESMTPSA id 49cKjP4Nkcz2QZ for ; Wed, 3 Jun 2020 10:07:20 +0300 (EEST) Message-ID: <6B27EF9A9A8F4CD1BB9ECAA950BE3AF4@dell2> From: "Andrus" To: "pgsql-general" Subject: canceling statement due to conflict with recovery after pg_basebackup Date: Wed, 3 Jun 2020 10:07:14 +0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="windows-1257"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 16.4.3528.331 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi! Async binary replication hot standby was started after pg_basebackup. Running query in slave throws error ERROR: canceling statement due to conflict with recovery Why ? Query should return table and other sizes in decreasing order. How to improve it so that this error does not occur. Log: 2020-06-03 09:40:52 EEST LOG: database system was interrupted; last known up at 2020-06-03 07:59:56 EEST 2020-06-03 09:41:10 EEST LOG: entering standby mode 2020-06-03 09:41:10 EEST LOG: redo starts at 2E2/28 2020-06-03 09:41:19 EEST LOG: consistent recovery state reached at 2E2/B5A56C8 2020-06-03 09:41:19 EEST LOG: database system is ready to accept read only connections 2020-06-03 09:41:19 EEST LOG: started streaming WAL from primary at 2E2/C000000 on timeline 1 2020-06-03 09:54:23 EEST 85.253.131.166 user@sba ERROR: canceling statement due to conflict with recovery 2020-06-03 09:54:23 EEST 85.253.131.166 user@sba DETAIL: User query might have needed to see row versions that must be removed. 2020-06-03 09:54:23 EEST 85.253.131.166 user@sba STATEMENT: select company_name(n.nspname)::char(20) as company, relname::char(25), pg_size_pretty(pg_total_relation_size(c.oid))::char(10) as totalsize, n.nspname::char(12), case when c.relkind='i' then 'index' when c.relkind='t' then 'toast' when c.relkind='r' then 'table' when c.relkind='v' then 'view' when c.relkind='c' then 'composite type' when c.relkind='S' then 'sequence' else c.relkind::text end ::char(14) as "type" from pg_class c left join pg_namespace n on n.oid = c.relnamespace left join pg_tablespace t on t.oid = c.reltablespace where (pg_total_relation_size(c.oid)>>21)>0 and c.relkind!='t' order by pg_total_relation_size(c.oid) desc Andrus.