Pcornel
Databases

Database Fundamentals

Cheat sheet · https://pcornel.dk/topic.php?topic=6085

Back to the Topic

Answer

A database stores structured data and serves it to applications through queries, guaranteeing consistency with transactions. Relational databases (PostgreSQL, MariaDB/MySQL, SQL Server) use tables, keys and SQL.

Remember

Separate the layers: network and authentication, the SQL itself, locks/transactions, server resources, and storage. Always know which engine and version you are on — syntax and tools differ.

First checks

  • SELECT version(); — 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

Verify in this order

application → connection (network, auth) → SQL → planner → storage engine → result

Where it usually breaks

Typical mistakes are mixing server/instance/database terminology, assuming ACID eliminates application-level race conditions, treating TCP reachability as a successful database session, or blaming storage before checking locks, sessions and engine state.

Database Fundamentals verification boundary matrix

BoundaryInspectHealthy interpretationDo not infer
IntentRelational modelIntended object/scope is explicit and versioned where relevantIntent is already effective
Owning runtime/control planeServer → instance → database → schema → table boundaries / Rows, columns and keysOwner accepts and reports the expected object stateDownstream dependencies are healthy
Effective stateACIDIndependent read-back matches the intended stateEvery client sees the same result
Consumer outcomeConnections and sessionsThe original bounded check succeeds in the same time windowProduction correctness outside this scope

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6085

Confirmation

Confirm action

Continue?