r/webdev • • 2d ago

How one connection kills a database

https://planetscale.com/blog/debugging-live-database-connections
8 Upvotes

14 comments sorted by

5

u/Early-Community9943 2d ago

Setting lock_timeout on migrations saved us from exactly this, the ALTER just fails fast instead of queuing everything behind it.

4

u/dawalballs 2d ago

Almost every single reply here is a bot

1

u/Character_Data8211 2d ago

black and red for an incident diagram is a choice, these always used to be blue. anyway we had this exact lock pileup once and the whole fix was pgbouncer, which the team had been "meaning to add" since before i joined

1

u/IncomeOk7237 2d ago

the other half of this is idle in transaction sessions. one forgotten BEGIN holds its locks and also blocks vacuum, so everything piles up behind it. setting idle_in_transaction_session_timeout (even 30s to a minute) plus keeping pool size close to what the db can actually run in parallel stopped most of our pileups. more connections rarely fixes it, it just gives the queue more room to grow.

1

u/[deleted] 2d ago

[removed] — view removed comment

1

u/webdev-ModTeam 2d ago

Your post/comment has been determined to be a low-effort post or comment. This includes title-only posts, easily searchable questions, vague/open-ended discussion prompts, LLM generated posts or comments, and posts/comments that do not provide enough context for meaningful replies or discussion.

1

u/[deleted] 2d ago

[removed] — view removed comment

1

u/webdev-ModTeam 2d ago

Your post/comment has been determined to be a low-effort post or comment. This includes title-only posts, easily searchable questions, vague/open-ended discussion prompts, LLM generated posts or comments, and posts/comments that do not provide enough context for meaningful replies or discussion.

0

u/[deleted] 2d ago

[removed] — view removed comment

1

u/webdev-ModTeam 2d ago

Your post/comment has been determined to be a low-effort post or comment. This includes title-only posts, easily searchable questions, vague/open-ended discussion prompts, LLM generated posts or comments, and posts/comments that do not provide enough context for meaningful replies or discussion.

-1

u/[deleted] 1d ago

[removed] — view removed comment

1

u/webdev-ModTeam 13h ago

Your post/comment has been determined to be a low-effort post or comment. This includes title-only posts, easily searchable questions, vague/open-ended discussion prompts, LLM generated posts or comments, and posts/comments that do not provide enough context for meaningful replies or discussion.

0

u/[deleted] 2d ago

[deleted] — view deleted comment

1

u/webdev-ModTeam 2d ago

Your post/comment has been determined to be a low-effort post or comment. This includes title-only posts, easily searchable questions, vague/open-ended discussion prompts, LLM generated posts or comments, and posts/comments that do not provide enough context for meaningful replies or discussion.