Found a backend process PROCESS_ID with a long running transaction whose transaction
id age AGE is larger than or equal to the transaction age threshold AGE_THRESHOLD.
配置自适应自动完全清理 (autovacuum)
默认情况下,AlloyDB 会启用自适应自动完全清理 (autovacuum)。您可以通过将实例的 enable_google_adaptive_autovacuum 数据库标志设置为 off 来停用自适应自动完全清理 (autovacuum)。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eAlloyDB for PostgreSQL uses adaptive autovacuum to automate the process of reclaiming storage space, preventing transaction ID wraparound, and updating table statistics.\u003c/p\u003e\n"],["\u003cp\u003eAdaptive autovacuum automatically adjusts resources like CPU, I/O, and memory for vacuum processes based on the real-time workload and available resources.\u003c/p\u003e\n"],["\u003cp\u003eBy monitoring transaction ID consumption, AlloyDB's adaptive autovacuum can prevent transaction ID wraparound by vacuuming all tables when necessary.\u003c/p\u003e\n"],["\u003cp\u003eAdaptive autovacuum is enabled by default in AlloyDB, but it can be disabled or modified using database flags.\u003c/p\u003e\n"],["\u003cp\u003eAlloyDB's adaptive autovacuum automatically detects blockers like long-running transactions and provides warnings in the \u003ccode\u003epostgres\u003c/code\u003e log.\u003c/p\u003e\n"]]],[],null,["# Configure adaptive autovacuum\n\nThis page provides an overview of AlloyDB for PostgreSQL adaptive autovacuum and describes\nhow to configure it.\n\nVacuuming is an important PostgreSQL database maintenance operation. It is used to\nreclaim storage space occupied by updated or deleted rows to avoid table or index\nbloat. It is also used for freezing transaction IDs to [prevent transaction ID wraparound](https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND) and for updating the table statistics.\n\nFor more information about vacuuming, see [Routine vacuuming](https://www.postgresql.org/docs/current/routine-vacuuming.html).\n\nTo automate the process of vacuuming and collectively updating the table statistics,\nAlloyDB supports adaptive autovacuum. *Adaptive autovacuum* enables\nautomatic adjustment of vacuum workload when your workload changes, removes dead\ntuples, and updates table statistics.\n\nAutovacuum ensures a reliable and consistent application transactional performance\nand maintains high availability of the system by preventing transaction ID wraparound.\n\nBy default, AlloyDB enables adaptive autovacuum. You can disable\nor modify adaptive autovacuum on AlloyDB by [using database flags](#view-cluster).\n\nBenefits\n--------\n\nAdaptive autovacuum offers the following benefits:\n\n- **Automatic adjustment of resources.** AlloyDB automatically adjusts\n resources such as CPU, I/O, number of vacuum processes, and memory for the vacuum\n process based on the real time status of the workload and available resources\n without affecting the system performance.\n\n- **Prevention of transaction ID wraparound.** AlloyDB monitors the\n vacuum progress and transaction ID consumption speed. When necessary,\n AlloyDB throttles its transaction ID consumption by\n vacuuming every table in the database, preventing transaction ID wraparound.\n\n- **Periodic vacuum for tables.** AlloyDB triggers autovacuum\n based on the number of dead tuples and the pages that need to be\n scanned. It removes dead tuples in a timely manner to avoid table or index bloat.\n\n- **Automatic detection of blockers.** AlloyDB automatically detects\n blockers such as long running transactions, orphan prepared transactions, orphan\n replication slots, and shows warning messages similar to the following in the\n `postgres` log:\n\n Found a backend process PROCESS_ID with a long running transaction whose transaction\n id age AGE is larger than or equal to the transaction age threshold AGE_THRESHOLD.\n\nConfigure adaptive autovacuum\n-----------------------------\n\nBy default, adaptive autovacuum is enabled on AlloyDB. You can\ndisable adaptive autovacuum by setting an instance's `enable_google_adaptive_autovacuum`\ndatabase flag to `off`.\n\nFor more information about setting database flags, see [Configure an instance's database\nflags](/alloydb/docs/instance-configure-database-flags).\n\nAlloyDB supports several standard PostgreSQL database flags related\nto vacuum and autovacuum, for example, `vacuum_cost_delay` and `autovacuum_vacuum_cost_delay`.\nYou do not need to set values in any of these flags for adaptive autovacuum to work\nbecause adaptive autovacuum adapts and optimizes its behavior to your real workloads.\nIf you set values in these flags, then adaptive autovacuum adjusts its behavior\nto take your preferences into account.\n\nTo see the complete list of supported PostgreSQL database flags related to vacuum\nand autovacuum, see [vacuum flags](https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-VACUUM-COST-DELAY)\nand [autovacuum flags](https://www.postgresql.org/docs/current/runtime-config-autovacuum.html)."]]