Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v3TOs-00Gm9V-6U for pgsql-admin@arkaria.postgresql.org; Tue, 30 Sep 2025 05:59:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v3TOq-006THJ-96 for pgsql-admin@arkaria.postgresql.org; Tue, 30 Sep 2025 05:59:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v3TOp-006THA-PW for pgsql-admin@lists.postgresql.org; Tue, 30 Sep 2025 05:59:44 +0000 Received: from mail-eastus2azolkn19010005.outbound.protection.outlook.com ([52.103.12.5] helo=BN1PR04CU002.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v3TOo-000q5G-1H for pgsql-admin@postgresql.org; Tue, 30 Sep 2025 05:59:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BHEd78BGKHNgLWRnfqh3FBCiuA7eYDTbxdLf/eZ2lVc63RzCVToeLO3R3tMd29mcQKpn2lrfdjD12ARpsH9jhqj6we+pp3FIvWNi7HjJte6IawS86dbAMktlhlpz/9+jId6i2qoURkt5OeMiPazabcUzsiHZN2IrRhTpKZj+sZFIMzEvmVr1uokXi34fuzSA0HLpCL/EfYCFkNGZnCLrOxKyGj5JqAoDEzThMUZtLCrVtNQjMX/tuy/lXzIS/aLas/KnWNJxsMlhVPZXpQjldxpqJDulVqtG5rnXAggY/S/ervknGeY6oy9FAGoRlkI1osKFPXpeRrs+UhXb+9PtiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fBgWrhGLBQjpklQRzQHMYUswX5dccNh1iWcBR1NVsuM=; b=HI6zEk0bpUCVBG9/KQmLntDpQS/vNewRJy2Ig6KrSggwwKY6irr1DzUR+sfU9wXHWbcrtY9ArnPP+A/vhrZ66hctJwx+gOmbSYfOunMgV2Q4R5Z0Y7t6HmrAVnNR7hVF9df1AXszHfC6ERTzbrjo3z/6dYAKwRQN7lI+2eYJ4h+y3UOOo63W28JZjVt1ey+TDRQalwJjkrq4eQu8l4MOD1Y9/TQSTtbNqetD39UwS6ZdALC0aaNJJBxhMzLmwx4yEYRX+RFEuJsLGhtKPMhboVr4PsO1WEzaPPcSq74zvCdslwOfJAZl/EQZLBO/2M9kXOqPzZAWEUM7yJiuUrr3zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fBgWrhGLBQjpklQRzQHMYUswX5dccNh1iWcBR1NVsuM=; b=dy+C6bUX347WL06swNyd/Yfmi6jaK/ZY0XadamesTvy6WMVksd+YoBRfLvBLer4fp7au1i2voN+OE0HmpWdtzDL2ZTRwCkkSmp9xQe6SMuIILL7JorRlFA9Snp6bEM0+rzADqvnBLcuiQWwukPBNsU1jYS6FI88/YgQyQ+/TeXxdGns0RzEhiMkWfSYS1ydJAEGQT2Sc23/uzROk0C0LDFX+UFEXlkcRWh9HE1l8M3d8Q215id5uDKX5m6f+xA0zCKTGPapFCUE+0tJuQ8ZY4L7IuxjSBOFkynbpzqrBoBs18B12/OwlbDjMWP1/qNK9iW64PyCOGspy55Bcl+fnbQ== Received: from EA2PR84MB3780.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:303:25b::18) by LV8PR84MB3630.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:408:20b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9160.17; Tue, 30 Sep 2025 05:59:39 +0000 Received: from EA2PR84MB3780.NAMPRD84.PROD.OUTLOOK.COM ([fe80::af88:ed17:72c3:3f4e]) by EA2PR84MB3780.NAMPRD84.PROD.OUTLOOK.COM ([fe80::af88:ed17:72c3:3f4e%5]) with mapi id 15.20.9160.015; Tue, 30 Sep 2025 05:59:39 +0000 From: Ishan joshi To: "pgsql-admin@postgresql.org" Subject: canceling/terminating statement due to conflict with recovery in Replica/DR instances Thread-Topic: canceling/terminating statement due to conflict with recovery in Replica/DR instances Thread-Index: AQHcMc3xjzw4H7//HE6V/BcR5HHmWw== Date: Tue, 30 Sep 2025 05:59:39 +0000 Message-ID: Accept-Language: en-IN, en-US Content-Language: en-IN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: EA2PR84MB3780:EE_|LV8PR84MB3630:EE_ x-ms-office365-filtering-correlation-id: 4cb679ff-dba0-44d9-1e98-08ddffe68ab7 x-microsoft-antispam: BCL:0;ARA:14566002|15030799006|15080799012|12121999013|11091999009|8062599012|8060799015|461199028|31061999003|19110799012|51005399003|39105399003|40105399003|440099028|3412199025|102099032|18061999006; x-microsoft-antispam-message-info: =?iso-8859-1?Q?CKuM7P694mSBkxzosehYKWzJWJ5oKpjK0Xy3ZVvmDlhEpLaVeQayQx8PDF?= =?iso-8859-1?Q?6yrw1HNrqN7bBZAXQKEv3xbK/eTgMiGEd0vm0sp9izgw99Z9p3VWG99hAn?= =?iso-8859-1?Q?btiKQ58g75oEuBup6yM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?= =?iso-8859-1?Q?FobVFylcSii9Ds4+SBnyR52A/KbWIKFrjIcrELiy4YkAkeeD8R3Jf6nIML?= =?iso-8859-1?Q?+NgsGEzynIQQL/JbczunQGieSXs9rNk5mlo90cnvmWYUtDJycHVbXWhH4J?= =?iso-8859-1?Q?OETvjgWL5qeTZHVpszorIg26HtNHczezaclMXXW5FszCMrSRpyoIoM5UIq?= =?iso-8859-1?Q?e+c9NCecAGl2xt9FSVury1pIM+kXQQ7R139/ANmtOB5iEAGifiujO/jTTb?= =?iso-8859-1?Q?NxGXEgtVj81hPcXuWNkdTHL9yiDH3JTv0tdEmFgVSV/sjqOGZPeIfPnAvE?= =?iso-8859-1?Q?Q+FGqy39MxkT/QxfBi67tyD1JgZzpJXu9vUEHmdzc7+yCz77vg5UEMhP1X?= =?iso-8859-1?Q?xkFzR8M2tFcU7afguWz/acrEIV6QDNQA=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?Xg3DssJWFc0DkoNdiT0DyH0NIBnXdijzlTX+TUok0y5BMzALEyKY73RRyO?= =?iso-8859-1?Q?kDbhSxEFOScAD3CIg3QxRHHwJVONIakWBsiQ5AC7r+QC4nla9MZ3CAvNKl?= =?iso-8859-1?Q?XccrHUXYWMaFFrPsIM9O6VVtPL2aLLEwJslyCi52otOmONiubKXFIXYld5?= =?iso-8859-1?Q?Jia017srxyXFdqXmG6BXdmoc5DV8cnygcsbuHDGmqS8EqqiJJUIXPa9U0c?= =?iso-8859-1?Q?59QGXF7g0ssQP2o3jymoJA88QkgO+59cAG3OVKOkSF7/jN1CWFqUoZUHFq?= =?iso-8859-1?Q?wcrWmhOpaD/qa+RDMtKTegnRtrZAbqWBXGjr7BZW9mZuOU4F9Iln7rqOjO?= =?iso-8859-1?Q?QaHpe4ZCnctPAJ9h5tDVWVnWVahMX6ILVisxwr7QzHqcsCP+DiUKwSxi1l?= =?iso-8859-1?Q?zT3cscACZXkrIm3xwSas68gOnN0iqZjsWaTMHlbMMoVge4VStMz7FP5M0L?= =?iso-8859-1?Q?7vI5OTEjRdUAMb+3UNOH8TL5B1tzUg7iSAwAtj9P6v3cDEn4ANT0gaAPaF?= =?iso-8859-1?Q?m4jQ8FbbRfY+RwAqN3egIvOOX3LlPQCdSv4H5YWjokxcxoaGE3jVVl21zv?= =?iso-8859-1?Q?etaFL6/ObV2dLmVC/o8JugHSO/PARlmV0OK8olqOjxZmpJ59Plqbu+SspP?= =?iso-8859-1?Q?lU364DQBt0HhIF6CYRpVzkIUCUeyXq/Q3C+orhVwbaNS0iHD/EY2Or3T7h?= =?iso-8859-1?Q?3O+zTr0v4apCIkxAg+JhAdkVI/Bxv7NbwvW/e77fwGRVAmDBPfCvJ5nb+N?= =?iso-8859-1?Q?x0gIvDWUhY0T47apgmNYGMJO3ToB6Ss5QYlUTslWjrVNhAgwikL+IRx8DB?= =?iso-8859-1?Q?3DPKsGWieGYOH3/ggKIutN7xUz0tD0NV5EMkKqsjjtJq1Wt4LgH1V7zh9C?= =?iso-8859-1?Q?HeR+3CKseUr3SIgvubc6CuKgZ4l4AqxTYeQRgosvc7Md8iRpJTT3GskpLL?= =?iso-8859-1?Q?TCrEIfTTtNYfol/wimNLJfsTowTZTMy7wmy6sS6+4D7ouGu8HXa9pQ3rj/?= =?iso-8859-1?Q?UMLRrvTIS/j+I+J4nyMlZgb5lgQ8BhbvoCgGKGPRgQGmV6/9WnXxgvhOdc?= =?iso-8859-1?Q?Pc66exc9QjABVIyIFsCDAeemZCMeT6wFQejiLoLtdsyc6ik9VDRn3TLbvv?= =?iso-8859-1?Q?GusKEzTYfhne+Pnr9A+o/rEH9YLzrMWh5hpwSE/MhaTauKetunMI5Qvus9?= =?iso-8859-1?Q?lNc07DYp188VUgY2fpHhPO98veC7tVLOkCt2D1m7AhPhBDMdkqkn/7MQSf?= =?iso-8859-1?Q?OAaIkSZgAkMwRQ8l4jnQ=3D=3D?= Content-Type: multipart/alternative; boundary="_000_EA2PR84MB3780EB1126501FD490A07807A91AAEA2PR84MB3780NAMP_" MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-8534-20-msonline-outlook-774d9.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: EA2PR84MB3780.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 4cb679ff-dba0-44d9-1e98-08ddffe68ab7 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Sep 2025 05:59:39.1035 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR84MB3630 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_EA2PR84MB3780EB1126501FD490A07807A91AAEA2PR84MB3780NAMP_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Team, We are using Postgresql 16.9 in production and with large database about 25= TB of size. We have patroni setup with replica instance and DR patroni setu= p with patroni streaming. We have high volume and frequent commit in the database. There are few larg= e tables for which we asked client to execute queries on DR/Replica instanc= es but these queries are start getting failed with "canceling statement due= to conflict with recovery" and "terminating statement due to conflict with= recovery" error. As I understand the behavior is correct but we need to get rid of this issu= e. I gone through the old posts and some documentation and got to know that be= low parameters can help to reduce this error. max_standby_streaming_delay max_standby_archive_delay hot_standby_feedback =3D off Our queries are running for long period that makes me to set this value to = some minutes/hours (lets set 900s) which is not feasible for production as = it will start impacting the replication lag. Also, the queries will fail if= it reaches to mentioned thresholds. If I set these parameters to "-1" (disable) then there will be direct impac= t on replication lag which will impact further queries on replica node and = DR cluster. Can you please guide If any other better solution present for such scenario= ? Thanks & Regards, Ishan Joshi --_000_EA2PR84MB3780EB1126501FD490A07807A91AAEA2PR84MB3780NAMP_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi Team,

We are using Postgresql 16.9 in production and with large database about 25= TB of size. We have patroni setup with replica instance and DR patroni setu= p with patroni streaming.

We have high volume and frequent commit in the database. There are few larg= e tables for which we asked client to execute queries on DR/Replica instanc= es but these queries are start getting failed with "canceling statemen= t due to conflict with recovery" and "terminating statement due to conflict with recovery" error.

As I understand the behavior is correct but we need to get rid of this issu= e.

I gone through the old posts and some documentation and got to know that be= low parameters can help to reduce this error. 

max_standby_streaming_delay 
max_standby_archive_delay 
hot_standby_feedback =3D off

Our queries are running for long period that makes me to set this value to = some minutes/hours (lets set 900s) which is not feasible for production as = it will start impacting the replication lag. Also, the queries will fail if= it reaches to mentioned thresholds.

If I set these parameters to "-1" (disable) then there will be di= rect impact on replication lag which will impact further queries on replica= node and DR cluster.

Can you please guide If any other better solution present for such scenario= ?

Thanks & Regards,
Ishan Joshi
--_000_EA2PR84MB3780EB1126501FD490A07807A91AAEA2PR84MB3780NAMP_--