Topic

SQL

Discover SQL best practices covering query optimization, database design, normalization, and relational database management. Our digest aggregates ACID compliance, transaction patterns, and distributed query from developer communities.

What this topic tracks

  • Database releases and ecosystem updates
  • Query, indexing, and modeling practices
  • Operational lessons from production systems

SQL · 85 stories

Recent stories

Each story's summary, with the places it was discussed.

Summaries are written by AI from the linked sources. Open the source for full context.

5 stories

SQLite for Everything

joecode.com · 19 Aug

Database · Software Architecture · SQL

The article argues that SQLite can replace many specialized systems—search engines, document stores, queues, caches, vector databases, time-series platforms, file storage, graph databases, and microservices—for workloads limited to one writer and one machine.

Its stability, portability, transactional consistency, low operational overhead, and performance make simplicity a powerful default, though PostgreSQL or specialized systems remain necessary at larger scales.

SQL: Incorrect by Construction

chreke.com · 10 May

Database · Software Architecture · SQL

SQL and relational databases often suffer from concurrency bugs like atomicity issues, TOCTOU, and deadlocks.

While techniques like transactions and explicit locking solve these problems, they increase complexity. The author advocates for a database system that prioritizes correctness by default, inspired by Rust’s fearless concurrency model, to ensure safer data handling.

Structured Primary Keys

modern-sql.com · 24 Jun

Database · Performance · SQL

The article proposes using 'Structured Primary Keys' to improve database performance and maintain data integrity.

By incorporating foreign keys into primary keys, databases avoid 'walled gardens' where tables become disconnected. This approach enables relational efficiency and prevents cross-entity inconsistencies, offering a more performant model than relying solely on surrogate keys.

The Internals of PostgreSQL

interdb.jp · 7 Mar

Database · PostgreSQL · SQL

The Internals of PostgreSQL is a comprehensive guide by Hironobu SUZUKI detailing the architecture and subsystems of the PostgreSQL relational database.

On its 10th anniversary, it covers version 18, including query processing, concurrency control, and replication. This resource provides technical depth for administrators and developers to understand the inner workings of this open-source system.

The real cost of random I/O

vondra.me · 26 Feb

Database · Performance · SQL

Evaluating the random_page_cost parameter in Postgres shows that default values often underestimate the cost of random I/O compared to sequential reads, even on modern SSDs.

Experiments reveal that local and remote storage latencies significantly impact query planning. The analysis also explores how prefetching and caching effects complicate cost modeling and plan selection.

Where it came fromLobstersCreate a Snapbyte.dev digest and choose SQL as one of your topics.Build your digest