Feed

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.

Articles from the last 30 days

It's 2026, Just Use Postgres
01Monday, February 2, 2026

It's 2026, Just Use Postgres

This article challenges the 'use the right tool for the right job' mantra that often leads developers to manage multiple specialized databases (Elasticsearch, Pinecone, Redis, etc.). Such sprawl creates technical debt, complex security models, and high operational costs. Instead, the author advocates for using PostgreSQL as a unified platform. Innovations like pgvector (vector search), TimeScaleDB (time-series), and pg_textsearch (BM25 search) allow Postgres to match specialized tools' performance using similar algorithms. This simplification is especially critical in the AI era, where maintaining consistent data for agents is easier within a single, atomic environment. The post concludes that 99% of companies can achieve their goals with Postgres alone, reducing architecture fragmentation and potential failure points.

Sources:Hacker News435 pts
Sqldef: Idempotent schema management tool for MySQL, PostgreSQL, SQLite
02Sunday, February 1, 2026

Sqldef: Idempotent schema management tool for MySQL, PostgreSQL, SQLite

sqldef is an innovative command-line interface tool designed to streamline database schema management by performing diff operations between two SQL schemas. Unlike traditional migration tools that require managing stateful migration files, sqldef allows developers to update their relational database management systems by comparing a desired SQL schema with the current live state. The tool provides robust support for a wide range of popular databases, including MySQL, MariaDB, TiDB, PostgreSQL, SQL Server, and SQLite3. By generating the necessary DDL statements to reconcile differences, it simplifies the Continuous Integration and deployment lifecycle for backend developers. Additionally, an online demo environment utilizes a WebAssembly build of sqldef, enabling users to experiment with schema comparisons and DDL generation directly within a web browser without local installation.

Sources:Hacker News226 pts
What Is a Database Transaction?
03Sunday, February 22, 2026

What Is a Database Transaction?

This article explores database transactions, explaining atomicity through BEGIN, COMMIT, and ROLLBACK. It compares Postgres's multi-versioning (MVCC) and VACUUM processes against MySQL's undo logs. Additionally, it details isolation levels—Serializable, Repeatable Read, Read Committed, and Read Uncommitted—and how both systems handle concurrent writes using locking or optimistic serialization.

Sources:Hacker News215 pts
We gave terabytes of CI logs to an LLM
04Friday, February 27, 2026

We gave terabytes of CI logs to an LLM

Mendral (YC W26) utilizes a SQL interface and ClickHouse to empower AI agents to investigate flaky CI tests. By denormalizing 48 metadata columns per log line, they achieve 35:1 compression and millisecond query latency. This architecture allows agents to autonomously scan billions of log lines, identifying root causes across months of history in seconds.

Sources:Hacker News173 pts
Two Bits Are Better Than One: making bloom filters 2x more accurate
05Monday, February 16, 2026

Two Bits Are Better Than One: making bloom filters 2x more accurate

Floe explains using bloom filters, probabilistic data structures that efficiently speed up SQL queries by filtering non-matching rows before decompression. By implementing a fixed-size 256KB filter with two bits stored in a single uint32, they reduced false positive rates by 2x (11.7% to 5.7%) with negligible performance costs, significantly optimizing database join operations.

Sources:Hacker News172 pts
How we made geo joins 400× faster with H3 indexes
06Thursday, February 5, 2026

How we made geo joins 400× faster with H3 indexes

Geospatial joins, which use spatial predicates like ST_Intersects, often suffer from performance issues at scale due to their quadratic complexity. While conventional joins utilize efficient hash partitioning, spatial predicates lack a clean join key, forcing expensive row-by-row comparisons. Floe addresses this by automatically rewriting queries to utilize H3 indexes, a hexagonal hierarchical tiling system that converts complex geometries into big-integer cell IDs. By representing shapes as sets of H3 cells, the system performs a fast integer equi-join as a pre-filter, followed by an exact spatial recheck to eliminate false positives. This method effectively reduces candidate pairs by up to 99 percent. Benchmark results show that optimizing H3 resolution can lead to speedups of nearly 400x compared to baseline queries, transforming expensive spatial operations into efficient parallel hash joins.

Sources:Hacker News154 pts
A DuckDB-based metabase alternative
07Wednesday, February 18, 2026

A DuckDB-based metabase alternative

Shaper is an open-source, SQL-driven business intelligence tool powered by DuckDB. It allows developers to build analytics dashboards through SQL, supporting Git-based workflows and AI-ready features. Users can embed white-labeled analytics using JS and React SDKs, automate reports, and connect to multiple data sources. It is self-hostable via Docker and licensed under MPL 2.0.

Sources:Hacker News149 pts
Git in Postgres
08Thursday, February 26, 2026

Git in Postgres

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.

Sources:Lobsters80 pts