Pcornel
Browse topics
Options
Recent
Favorites
Databases · Technical reference

Database Troubleshooting

Direct answer

Database troubleshooting separates connectivity, authentication, query, locking, resource and storage problems using logs, activity views and plans.

When to use this

Use it as the entry point when a database is down, slow or rejecting clients.

First 30 seconds

1. Server running? systemctl status postgresql (or mariadb / MSSQLSERVER) and the error log.

2. Connect test from the client host: nc -vz <host> <port>.

3. Activity/blocking views.

4. Slow query and plan.

5. Disk/WAL/log space.

Operational verification

service → network → auth → session → query → locks → storage

Evidence · next step

The most damaging mistakes are restarting before capturing lock/crash state, increasing limits blindly, deleting log/WAL files to free space, breaking replication history during troubleshooting, or treating a recovered engine process as proof of data consistency. Preserve the first divergent observation and repeat the same bounded verification after remediation.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
What not to infer

This Topic owns cross-engine triage. Product-specific recovery depth belongs in MariaDB/MySQL, PostgreSQL or SQL Server Topics; host/storage/network causes link to their canonical Domains.

Platform / version applicability
MariaDB / MySQL / PostgreSQL / Microsoft SQL Server concepts
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformMariaDB / MySQL / PostgreSQL / Microsoft SQL Server concepts · This Topic owns cross-engine triage. Product-specific recovery depth belongs in MariaDB/MySQL, PostgreSQL or SQL Server Topics; host/storage/network causes link to their canonical Domains.
Scope / prerequisiteUse it as the entry point when a database is down, slow or rejecting clients.
What next?3 suggested next steps
Child topics (this level)3
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification workflow Verify boundary

Reproduce one bounded failing connection/query, record timestamp/session/query identity and error code, then move layer by layer from client to engine state. For destructive recovery actions, stop and preserve logs/backup state first; after repair, repeat the same transaction or service-level check.

Step 2 Failure signatures and limits Narrow the fault

The most damaging mistakes are restarting before capturing lock/crash state, increasing limits blindly, deleting log/WAL files to free space, breaking replication history during troubleshooting, or treating a recovered engine process as evidence of data consistency.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

test · 1
Drill down

Subtopics

Go one level deeper into this subject.

Key points

Read the server error log first. Then: can clients connect? Are sessions blocked? Is a query slow? Is the disk full? Fix the first failing layer.

Key checks
  • systemctl status postgresql — first check for this topic
  • psql -c "SELECT now(), version();" — PostgreSQL reachable and version
  • mysql -e "SELECT NOW(), VERSION();" — MariaDB/MySQL reachable and version
  • sqlcmd -S <server> -Q "SELECT @@VERSION" — SQL Server reachable and version
ReferenceWhat it is1 section · depth on demand

Operating model

Database Troubleshooting organizes symptoms by boundary: client resolution/network, listener/service, authentication/authorization, session capacity, query/lock engine, storage/log space, replication and recovery. Preserve the first concrete engine/client error before changing configuration.

ReferenceHow it works1 section · depth on demand

In depth

Database troubleshooting starts with the symptom and narrows down to connections, locks, resource limits or specific queries.

SymptomFirst checks
Cannot connectService running, listen address/port, firewall, pg_hba.conf/host grants, max connections, TLS settings
Slow everythingCPU/I/O saturation, memory, locks, checkpoint/log pressure
One query slowExecution plan, statistics, missing index, parameter differences
Application hangsBlocking chains, long-open transactions
Disk fullData growth, log/WAL accumulation (archiving or replica failures), temp files
Replica behindNetwork, long queries on replica, I/O
-- PostgreSQL: who blocks whom
SELECT pid, pg_blocking_pids(pid) AS blocked_by, state, left(query,60) FROM pg_stat_activity WHERE cardinality(pg_blocking_pids(pid)) > 0;
-- MariaDB/MySQL
SHOW FULL PROCESSLIST;
SELECT * FROM information_schema.INNODB_TRX\G

Read the database error log early — it usually states exactly why connections are refused or why the server restarted.

ReferenceImportant terms & boundaries1 section · depth on demand

Scope map

  • Cannot connect / refused / timeout
  • Authentication failures
  • Slow query
  • Locking/deadlock
  • Too many connections
  • Disk full / log growth
  • Replication lag/failure
  • Crash recovery
  • Corruption/recovery boundaries
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical examples

Configuration & expected output

Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.

Configuration example

PostgreSQL / Linux PostgreSQL 14 or laterWalk the connection path from client to server.

Assumptions: Replace host and port.

getent hosts db1
nc -vz db1 5432
pg_isready -h db1 -p 5432
psql "host=db1 dbname=app user=app_ro" -c "SELECT 1;"

Expected output

PostgreSQL / Linux PostgreSQL 14 or laterpg_isready -h db1 -p 5432

Expected state: The server accepts connections on the expected host and port.

db1:5432 - accepting connections
"no response" means network or listener; "rejecting connections" means the server is starting or shutting down; a successful pg_isready still does not prove authentication or pg_hba rules. Illustrative authored output: field layout matches the tool, values will differ in your environment.
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-29 · otherMariaDB / PostgreSQL / Microsoft SQL Server concepts PostgreSQL current documentation

Documentation verification: confirms the upstream model used by the Topic. It does not assert local production behavior.

Basis: https://www.postgresql.org/docs/current/monitoring.html · confidence 92%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
database troubleshootingdatabase connection refuseddatabase deadlockdatabase disk full
Embedded reference data

Quick lookup tables

Database Troubleshooting verification boundary matrix

A compact lookup separating intent, owning component state, effective state and consumer-visible outcome for Database Troubleshooting.

BoundaryInspectHealthy interpretationDo not infer
IntentCannot connect / refused / timeoutIntended object/scope is explicit and versioned where relevantIntent is already effective
Owning runtime/control planeAuthentication failures / Slow queryOwner accepts and reports the expected object stateDownstream dependencies are healthy
Effective stateLocking/deadlockIndependent read-back matches the intended stateEvery client sees the same result
Consumer outcomeToo many connectionsThe original bounded check succeeds in the same time windowProduction correctness outside this scope
Depth when you need it

Deep reference

Design & tradeoffs

Scope

Product-specific recovery depth belongs in MariaDB/MySQL, PostgreSQL or SQL Server Topics; host/storage/network causes link to their canonical Domains.

Confirmation

Confirm action

Continue?