TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A Mysterious PostgreSQL Performance Bug

14 点作者 wgyn大约 4 年前

1 comment

natmaka大约 4 年前
When facing such ordeal and if you can accept to impact availability just VACUUM FREEZE the most impacted tables (or, if in doubt, the whole database).<p>If transaction activity is somewhat predictable adjust your autovacuum parameters per-table, using &quot;ALTER TABLE ((tablename)) SET&quot;, to have it kick not too early (constantly fiddling) and not too late (at worse leading to an automatic emergency DB locking preventing a wrapping). See <a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;current&#x2F;sql-altertable.html" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;current&#x2F;sql-altertable.html</a> Pertinent parameters: autovacuum_analyze_scale_factor autovacuum_analyze_threshold autovacuum_enabled = true autovacuum_vacuum_insert_scale_factor autovacuum_vacuum_insert_threshold autovacuum_vacuum_scale_factor autovacuum_vacuum_threshold autovacuum_vacuum_cost_delay autovacuum_vacuum_cost_limit<p>If multiple clients simultaneously hammer INSERT or UPDATE a table you can modify their sourcecode in order to have them cooperate by using PG&#x27;s advisory locking, see <a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;13&#x2F;explicit-locking.html#ADVISORY-LOCKS" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;13&#x2F;explicit-locking.html#ADV...</a>