<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/postgresql-lockup-vs-stale-connection-how-to-tell-them-apart-ctzk0b0lo" -->

---
title: PostgreSQL Lockup vs Stale Connection: How to Tell Them...
description: Two failure modes produce the same &#x27;database is locked up&#x27; symptom in PostgreSQL: a true server lockup and a stale connection in the application pool. A true...
canonical: https://daily.dev/posts/postgresql-lockup-vs-stale-connection-how-to-tell-them-apart-ctzk0b0lo
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: PostgreSQL Lockup vs Stale Connection: How to Tell Them Apart | daily.dev
og:description: Two failure modes produce the same &#x27;database is locked up&#x27; symptom in PostgreSQL: a true server lockup and a stale connection in the application pool. A true...
og:url: https://daily.dev/posts/postgresql-lockup-vs-stale-connection-how-to-tell-them-apart-ctzk0b0lo
og:image: https://api.daily.dev/og/posts/CTZK0B0lo.png
og:image:alt: PostgreSQL Lockup vs Stale Connection: How to Tell Them Apart
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# PostgreSQL Lockup vs Stale Connection: How to Tell Them Apart

**[Planet PostgreSQL](https://daily.dev/sources/planet-postgresql)** · 8 min read · 0 upvotes · 0 comments

## Summary

Two failure modes produce the same 'database is locked up' symptom in PostgreSQL: a true server lockup and a stale connection in the application pool. A true lockup means no new connections can be established from anywhere, often caused by OS-level resource exhaustion. A stale connection means Postgres is healthy but a pooled connection died silently due to a load balancer, NAT gateway, or network interruption dropping the TCP session without notifying both sides. A five-step checklist helps distinguish them in under five minutes: try a fresh direct connection, check if only pre-existing pooled connections fail, look for 'reset by peer' errors in logs, and inspect pg_stat_activity. Fixes for stale connections involve configuring tcp_keepalives_idle/interval/count on the Postgres server, enabling keepaliveTime in HikariCP, tuning server_idle_timeout and client_idle_timeout in PgBouncer, and ensuring keepalive intervals are shorter than any middlebox idle timeout (e.g., AWS ALB defaults to 60s). PostgreSQL 14's client_connection_check_interval is also highlighted as an underused setting.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://postgr.es/p/9ra>

---

Tags: [#database](https://daily.dev/tags/database), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/postgresql-lockup-vs-stale-connection-how-to-tell-them-apart-ctzk0b0lo)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"PostgreSQL Lockup vs Stale Connection: How to Tell Them Apart","url":"https://daily.dev/posts/postgresql-lockup-vs-stale-connection-how-to-tell-them-apart-ctzk0b0lo","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/postgresql-lockup-vs-stale-connection-how-to-tell-them-apart-ctzk0b0lo"},"datePublished":"2026-08-03T15:48:21.746Z","dateModified":"2026-08-03T15:49:15.592Z","description":"Two failure modes produce the same 'database is locked up' symptom in PostgreSQL: a true server lockup and a stale connection in the application pool. A true...","image":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","thumbnailUrl":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","isAccessibleForFree":true,"articleSection":"Planet PostgreSQL","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Planet PostgreSQL","logo":"https://media.daily.dev/image/upload/logos/placeholder.jpg","url":"https://daily.dev/sources/planet-postgresql"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/postgresql-lockup-vs-stale-connection-how-to-tell-them-apart-ctzk0b0lo","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"database,postgresql","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet PostgreSQL","item":"https://daily.dev/sources/planet-postgresql"},{"@type":"ListItem","position":3,"name":"PostgreSQL Lockup vs Stale Connection: How to Tell Them Apart"}]}
```

