Home / Companies / GitLab / Blog / Post Details
Content Deep Dive

Why we spent the last month eliminating PostgreSQL subtransactions

Blog post from GitLab

Post Details
Company
Date Published
Author
Grzegorz Bizon and Stan Hu
Word Count
3,375
Company Posts That Month
22
Language
English
Hacker News Points
-
Post removed?
No
Summary

In an investigation to resolve mysterious database stalls on GitLab.com, it was discovered that SQL SAVEPOINT queries within long transactions were causing performance issues on database replicas, leading to 500 errors for users. The problem, dubbed "Nessie," was traced to PostgreSQL's handling of subtransactions, where a single SAVEPOINT during a long transaction could trigger suboverflow, leading to cache misses and high disk I/O. This was exacerbated by replication differences between primary and replica databases. To mitigate this, GitLab eliminated all SAVEPOINT queries from their code, which resolved the issue. The investigation was aided by extending observability tools and leveraging community expertise, highlighting PostgreSQL's robust code but also its limitations in handling subtransactions. The team considered but ultimately opted against using unofficial PostgreSQL patches that could allow larger subtransaction caches, focusing instead on code modifications to prevent the issue from recurring.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.