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.

20 stories

Ok, but does it scale?

spacetimedb.com · 3 Sept

Database · Distributed Systems · SQL

Spacetime scales by separating compute, storage, and networking rather than imposing distributed coordination on every transaction.

Its single-threaded databases deliver high performance under contention, while sharding, replication, tiered storage, read replicas, inter-database communication, and future partitioning scale parallel workloads. The approach preserves a fast local path and charges coordination costs only when workloads require them.

Making Postgres queues scale

dbos.dev · 30 Jul

Database · PostgreSQL · SQL

Conventional wisdom suggests Postgres cannot scale as a queue, but with optimizations, it can reach 30K executions per second.

Key strategies include using SKIP LOCKED to reduce contention, adjusting transaction isolation levels to avoid serialization failures, and creating selective, partial indexes to minimize CPU overhead and autovacuum impact.

databow: a Rust CLI to query any database with an ADBC driver

columnar.tech · 2 Jun

CLI · Database · SQL

databow is a new open-source command-line tool written in Rust that provides a unified interface for querying diverse databases using the ADBC standard.

It replaces fragmented CLIs with a consistent, high-performance experience, supporting over 30 databases, interactive SQL shells, scripted automation, and versatile data export options to streamline workflows for data engineers.

Columnar Storage Is Normalization

buttondown.com · 20 Apr

Data Science · Database · SQL

Columnar storage can be interpreted as an extreme form of database normalization, where the implicit index acts as a primary key.

Reconstructing a row from columnar data is conceptually equivalent to performing a join operation. This mental model unifies data formatting with query operations like projections, highlighting that storage layout is a critical implementation detail affecting query performance.

Show HN: Tusk for macOS and Gnome

shapemachine.xyz · 4 Apr

Database · PostgreSQL · SQL

This comparison table details the feature differences between two database management tools for PostgreSQL.

It covers key functional areas including connection management, schema browsing, table inspection, data management, SQL editing, and file exploration, highlighting specific capabilities unique to each application's implementation.

O que são essas letrinhas: ACID

dev.to · 17 Jul

Database · PostgreSQL · SQL

ACID—Atomicity, Consistency, Isolation, and Durability—is a foundational set of properties for database transactions.

These paradigms ensure data integrity and reliability, especially in sensitive contexts like finance. By utilizing examples in PostgreSQL, this analysis demonstrates how ACID principles maintain system consistency, prevent partial updates, manage concurrent operations, and ensure persistent data despite failures.

Announcing DuckDB 2.0.0 LTS “Cinnamon Teal”

duckdb.org · 21 Oct

Database · SQL

DuckDB 2.0.0 LTS “Cinnamon Teal” is the project’s largest feature release, built from nearly 20,000 commits since 1.5 and supported until at least October 2027.

It adds a production-ready Quack client-server protocol, remote query pushdown, asynchronous Parquet/CSV I/O, first-class columnar VARIANT support, CLI agent mode, triggers, and an extensible PEG-based SQL parser. It also introduces a C++17 requirement and storage-format compatibility considerations for migration.

Git in Postgres

nesbitt.io · 26 Feb

Database · PostgreSQL · SQL

Gitgres is an experimental system that uses PostgreSQL as a storage backend for Git repositories via libgit2.

By treating Git objects and refs as database rows, it simplifies DevOps by unifying application data and repository storage, enabling complex SQL queries across code and metadata while streamlining backups and scalability.

Jepsen: MariaDB Galera Cluster 12.1.2

jepsen.io · 16 Mar

Database · Distributed Systems · SQL

Jepsen tested MariaDB Galera Cluster by simulating network faults and crashes.

Findings reveal significant data persistence issues, including the loss of committed writes during node recovery, as well as consistency anomalies like Lost Updates and Stale Reads in healthy clusters. The study concludes that the system's actual performance fails to meet documented consistency and availability claims.

Gems of DuckDB 2.0.0

duckdb.org · 26 Oct

Database · SQL

DuckDB 2.0.0 adds a broad set of smaller usability, SQL, data, and extension improvements alongside its headline features.

The Python client now provides an appender for batched row insertion; the CLI gains formatted .schema, .manual, calculator, and queryable history. New capabilities include SHOW for settings, SECURE VIEW, regexp_extract options, sequence setval, session-variable parameter fallbacks, custom partition paths and ordering, and GeoJSON/GeoJSONL writing. Community extensions publish compatibility matrices, and extensions can define cataloged window functions.

From JSON Strings to Typed Columns

duckdb.org · 16 Oct

Database · SQL

DuckDB can convert a table’s JSON text column directly into typed columns without a file round trip.

Cast the column to JSON, use json_group_structure to infer a schema, adjust types with json_merge_patch, and apply json_transform followed by unnest. Nested objects become STRUCTs, arrays can be unnested into rows, and missing fields become NULL. json_transform_strict exposes conversion errors, while typed storage avoids reparsing JSON in later queries.

SQLite 3.53.0

sqlite.org · 9 Apr

Database · SQL · SQLite

SQLite 3.53.0 introduces the Query Result Formatter (QRF) library to enhance CLI output, adds support for modifying constraints in ALTER TABLE, improves the query planner, and introduces new JSON functions.

It also provides new C APIs and optimizations while addressing critical reliability fixes like the WAL-reset corruption bug.

Why ALTER TABLE is such a problem for SQLite

sqlite.org · 13 Nov

Database · SQL · SQLite

SQLite provides limited support for the ALTER TABLE command, primarily allowing table and column renames, and the addition or deletion of columns.

While simple renames and additions are fast because they only modify schema text, certain operations like adding constraints or dropping columns require rewriting table data. For complex schema changes not directly supported, a 12-step manual procedure involving temporary tables is recommended to maintain database integrity and cross-version compatibility.

Production query plans without production data

boringsql.com · 8 Mar

Database · Performance · SQL

PostgreSQL 18 introduces pg_restore_relation_stats and pg_restore_attribute_stats, allowing users to export and inject optimizer statistics as portable SQL artifacts.

This feature enables developers to replicate production query plans in CI/CD or local environments without needing full production datasets, significantly improving performance debugging and preventing query regressions.

A Preview of DuckDB v2.0

duckdb.org · 17 Aug

Database · Performance · SQL

DuckDB v2.0 “Cyanoptera,” arriving this fall, shifts DuckDB toward server deployments with Quack and CONNECT, while adding VARIANT improvements, triggers, asynchronous object-storage I/O, major SQL extensions, faster recursive queries and partition pruning, a new storage format and PEG parser, native timezone support, and stable C APIs with signed private extension repositories.

It includes carefully chosen breaking changes.

The impersonator's product is the gap between meaning and spelling, so we measured both in Snowflake

dev.to · 6 Sept

Algorithms · Database · SQL

GLASSPOCKET is an accountability engine combining Snowflake’s VECTOR_COSINE_SIMILARITY and Jaro-Winkler analysis with H3-based delivery checks, and Solana devnet compressed-NFT receipts.

It compares meaning versus spelling to expose synthetic charity impersonations, scores geographic and reporting anomalies, and publishes privacy-preserving attestations. Testing found 97.8% precision but weak disaster-name recall; receipts also exposed duplicate minting and other implementation limits.

All you need is PostgreSQL

ebellani.github.io · 25 Jun

Database · PostgreSQL · SQL

Eduardo Bellani argues that many engineering problems, often solved with complex distributed systems, can be effectively handled using vanilla PostgreSQL.

By leveraging features like temporal tables, updatable views, and rigorous constraint triggers, teams can maintain data integrity, enforce business rules, and ensure high performance without unnecessary infrastructure complexity or architectural overhead.

De 6 horas para 40 segundos: como um índice de banco de dados salvou um job crítico de produção

dev.to · 6 Jun

Database · Performance · SQL

This case study details how adding a well-designed composite index saved a critical production job, reducing execution time from six hours to 40 seconds.

By analyzing performance bottlenecks using Azure Application Insights, the team identified that a covering index eliminated costly full table scans, significantly improving query efficiency without requiring code refactoring or architectural changes.

Detecting Full Table Scans With SQLite

tenderlovemaking.com · 15 Jul

Database · SQL · SQLite

This article explores how to detect SQLite full table scans programmatically using statement statistics API.

By monitoring the fullscan_steps metric, developers can identify inefficient queries during testing and development, allowing for performance optimizations like index creation, which helps improve database reliability and efficiency in applications like those built with Ruby on Rails.

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