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.96) (envelope-from ) id 1w4hi2-002TH5-0x for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Mar 2026 16:00:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w4hhz-001BUj-0z for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Mar 2026 16:00:51 +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.96) (envelope-from ) id 1w4hhy-001BUa-33 for pgsql-hackers@lists.postgresql.org; Mon, 23 Mar 2026 16:00:51 +0000 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w4hhw-00000000iho-1lRw for pgsql-hackers@postgresql.org; Mon, 23 Mar 2026 16:00:51 +0000 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-7d7e9b97a73so1812477a34.0 for ; Mon, 23 Mar 2026 09:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774281647; cv=none; d=google.com; s=arc-20240605; b=QoaMbdzRe92vJj6h9w1PxHCE6Qptpgyt2OFTxAhQMl0uKUt+wjagVbgXFsGMqPhLOI HenwSBFFzFIRZCO4Joe/n2ThlVEZhGkUJbA0cVy+CGP1IrAEuA2Cyg8nP69AMBcaHzLe 9Dc5n3qooPFbEsQBFO+bnQeVWi5GOTEO1AdT1Hac5CxVof1Qlqo5YWmkKec6iwE1bwU9 n7GirETa/KKc/jdwVpfcKVRe2Ak7fZv7G4jkFuL0nJXyXXbxS+1xYHeFz3PZ/JVEIDhu Fu8Bt3jGdnyuxeixKfbFCfyyIiVN5mhNRhFp7EXEVWW3dk84lOIituGA+pZFV2BWELFO FDzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=V9QwWhYWKip95OFd3e5QBMB9y1YVMPBEt3H0iDe5VoI=; fh=Ou/+TeoCsBYR9K7qiUY9n5vDfQTsZA1hTxXdKsJHk44=; b=bD4PP6/8M+bE60PSFzlJjcZBXAiMznQPenzWNdcFqmra0tZUcJqg2LJmDZYnr6y+dA N47OtMv/S+oZTCTCeGi+16n3oHiHaiEB9N2l/IL0umfideMxqCtwxaYscuSgxOmi3elg ptLiW2gVsJbzYulR4oAIiUrseoX6qp/8KTV9yFPoO9wRyuZbGi2icPG9IjAJlYe2MisL 6iWxOi0zP86Z6EMdp2IzyDo1jSobE+7ab3zseAFIK/vSisefhd7yPEZ1E4uH1MJPMFOp yqgF5/RYdslu6GITO1x+Bw4eChPIOkfUr+7tzVrzrTA2OXgxGA9OUA9uZ5FRqDwQ64Bu AE5A==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1774281647; x=1774886447; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=V9QwWhYWKip95OFd3e5QBMB9y1YVMPBEt3H0iDe5VoI=; b=m3DNa46Kl2NNSoHcgBrowReoQrDyU2rh1RH7oIi0I4fd1hhOxWnhIs2VnMp9HBwRV/ 4+pmuNUTCiDAGdJvckSQk6Pib8Bc+9UFYJ+ikrcIA4kzVRiEVlwkwim3isLdENniBofQ qOp4YQJn0/5DXL8T9rvfipxyo1rboaOXEMzNK8n3Qfr9MokqwYObcIGWst62EfCR0kR/ 4JZM9FP7AdNTxnoE2j8gW0XzjcPLBaqG5LVQChIYr/MI0b2eZpgIrcyYEM/RkZklYJtN SogMMZfmQuiTwIjfQjTqymWM+rys7q29J5/nQm8SS/ehRGVb+QJt4JMEHKr2LIeU4rlh Q84A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774281647; x=1774886447; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=V9QwWhYWKip95OFd3e5QBMB9y1YVMPBEt3H0iDe5VoI=; b=s0mIZe2P8aFP8vKMBanFVlZKNFlhVfoC+RmJp9YBAn/m3Gjwi+u/IP0VBhHFyqRudv MSjsHJBUAzyiAvyqvDJ5rwuna3dXXx3Q9C3ND1JmJQ3EVpwIzwV/Z/TSFOBTQWH0wfpJ cDlD6TNxV//rtUJau/rFeTadKW0I7T5MzmW3/eIH2ecmlJ7RBmtLquzOdxQ+Q4o38naP RmW7IOy2UW6iNkIMIsg4tGT5omCuL52HmU6wfZpUnJSFAF9di4LPPBK1p3A3pYXhnUiv cB+YyB71up15LTNYB3FAjRKg00ODcxPbyac9yYfZW6efngp2ujOxJNX7+/9G6Yad5rnG 3t3A== X-Forwarded-Encrypted: i=1; AJvYcCX3wpukgoiAiDcmK37YEKwEpnQeHFVGfmUgDTF7nVcx8VKX+4nQpgWOJxeNcmJ9dMpHnR38GY+kgOIcOver@postgresql.org X-Gm-Message-State: AOJu0YxEP5bIyaToirMlnL/+E1I1zU95baU4VH8tTuA3tD2t3zlEIXAi 0HnqsUE4eQdDVXNTT2910xu559aX3/ObVGRrzd61JK4/jtpSW8N72Zkx3EGKolHKiSQaCm3m7uG jiumYr0FVo3RxWvLsMlXUw4DVxW6WOig= X-Gm-Gg: ATEYQzyeMypv+RSHG6QBGCutpZMg57dIscx7sWKztA8xUJFcPbGJ41hFcffql4qIJIW uKfB6XPuiPkPznPbZWw1/vhPqexnapB3Qv8mwHzYkq8ICB9m8/W7BYyReVaNxwZ1sU5jJIyYKVB WJ1S9vZOcdJCFYNzSAjE7SQBpOC0vt7sXCFzshM+evCJKFz4qmaNMZGCWKuJKK7o5SjvVSEBshG r9XLMvsVDRDj9M449zBuYWX4rKDgEbzixTc7x9rVBYAkjATb4dSX31VRaOmMk5gIq7ZUjEyVfUA u1O4MBsGmyfWKLQFZ1zpwbZ/bd6oOGfwWthuw8XuB7JlPWhW5Q== X-Received: by 2002:a05:6820:c93:b0:67d:e770:748d with SMTP id 006d021491bc7-67df5d53e37mr74887eaf.15.1774281647371; Mon, 23 Mar 2026 09:00:47 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bharath Rupireddy Date: Mon, 23 Mar 2026 09:00:00 -0700 X-Gm-Features: AaiRm50aSDIgoFz8yEw70gIFyEnjvUn-IWMimn9FVaZgvpoDJOlq1N8jtJ0p1UA Message-ID: Subject: Re: Introduce XID age based replication slot invalidation To: SATYANARAYANA NARLAPURAM Cc: "Hayato Kuroda (Fujitsu)" , John H , PostgreSQL-development Content-Type: multipart/mixed; boundary="00000000000052d24c064db323a8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000052d24c064db323a8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Fri, Mar 20, 2026 at 11:29=E2=80=AFPM SATYANARAYANA NARLAPURAM wrote: > > Do you think we need different GUCs for catalog_xmin and xmin? If table b= loat is a concern (not catalog bloat), then logical slots are not required = to invalidate unless the cluster is close to wraparound. IMO the main purpose of max_slot_xid_age is to prevent XID wraparound. For bloat, I still think max_slot_wal_keep_size is the better choice. Where max_slot_xid_age is really useful is when the vacuum can't freeze because a replication slot (physical or logical) is holding back the XID horizon and the system is getting close to wraparound. Invalidating such a slot clears the way for vacuum. Setting max_slot_xid_age above vacuum_failsafe_age allows vacuum to waste cycles scanning tables it cannot freeze. Keeping max_slot_xid_age <=3D vacuum_failsafe_age (default 1.6B) prevents this by invalidating the slot before vacuum effort is wasted. As far as XID wraparound is concerned, both xmin and catalog_xmin need to be treated similarly. Either one can hold back freezing and push the system toward wraparound. So I don't think we need separate GUCs for xmin and catalog_xmin unless I'm missing something. One GUC covering both keeps things simple. >> I made the following design choice: try invalidating only once per >> vacuum cycle, not per table. While this keeps the cost of checking >> (incl. the XidGenLock contention) for invalidation to a minimum when >> there are a large number of tables and replication slots, it can be >> less effective when individual tables/indexes are large. Invalidating >> during checkpoints can help to some extent with the large table/index >> cases. But I'm open to thoughts on this. > > It may not solve the intent when the vacuum cycle is longer, which one ca= n expect on a large database particularly when there is heavy bloat. This design choice boils down to the following: a database instance having either 1/ a large number of small tables or 2/ large tables.