Best of SQLJanuary 2026

  1. 1
    Article
    Avatar of phProduct Hunt·18w

    RelateDB: Offline-first database schema designer in your browser

    RelateDB is a browser-based database schema designer that works entirely offline without requiring accounts or cloud services. It allows developers to visually model tables and relationships, import and export SQL or DBML formats, auto-arrange diagrams, and export schemas as images. All functionality runs locally in the browser for fast, frictionless schema design.

  2. 2
    Article
    Avatar of databasedailyDatabase Daily·17w

    A real production SQL query showed me why working SQL isn’t always correct.

    A blog post shares practical SQL lessons learned from a real production query, covering data grain mistakes like duplicate handling, CASE statement priority ordering, collation issues that affect joins, and techniques for writing queries that produce decision-ready results.

  3. 3
    Article
    Avatar of atomicobjectAtomic Spin·18w

    Kysely: Type-Safe SQL Without ORM Overhead

    Kysely is a TypeScript SQL query builder that provides strong type safety without the complexity of a full ORM. It catches common database bugs like mistyped column names and incorrect return types at compile time through TypeScript inference. The library offers a thin abstraction over SQL with readable chaining syntax, strongly typed where clauses, intuitive migrations with up/down functions, and automatic type generation from database schemas using kysely-codegen. Unlike ORMs, it stays focused on query building while maintaining SQL-like expressiveness, making it suitable for teams comfortable with SQL who want compile-time safety and lightweight tooling.

  4. 4
    Article
    Avatar of sspData Engineering Blog·19w

    A Diary of a Data Engineer

    Data engineering has evolved through multiple epochs from the 1970s to today, but the core loop remains unchanged: ingest, model, transform, serve, break, rebuild. Despite shifting from SSIS and star schemas to dbt and Iceberg, data engineers still solve the same fundamental problems with different tools. The role requires understanding business logic, data modeling fundamentals, and DevOps principles while accepting the paradox of being invisible when things work but scrutinized when they break. Success comes from mastering timeless fundamentals like SQL and dimensional modeling rather than chasing every new framework, talking to business stakeholders to understand why data matters, and building reliable foundations that enable better decision-making.

  5. 5
    Article
    Avatar of duckdbDuckDB·17w

    Announcing DuckDB 1.4.4 LTS

    DuckDB 1.4.4 LTS has been released with bugfixes, performance improvements, and security patches. Key fixes include correctness issues with ANTI JOINs, ASOF joins, streaming window unions, and the mode() function in parallel execution. The release also addresses several crashes and segfaults, including issues with Hive partitioning and the C API. Performance optimizations include improved prepared statement parameter lookups. Version 1.5.0 is planned for the coming month, while the 1.4 LTS line will receive updates until mid-September.

  6. 6
    Article
    Avatar of hnHacker News·18w

    Introducing Lix: A universal version control system

    Lix is a universal version control system that can diff any file format, including binary files like Excel, PDF, and DOCX. Unlike Git's line-based diffs, Lix understands file structure and shows semantic changes (e.g., 'price: 10 → 12' instead of 'line 4 changed'). Built on top of SQL databases, it provides version control through virtual tables queryable via SQL. Originally developed for inlang localization infrastructure, Lix addresses Git's limitations with binary and structured files, making it particularly useful for AI agent workflows where changes to non-text files need human review. Currently available for JavaScript with Python, Rust, and Go SDKs planned.

  7. 7
    Article
    Avatar of planetpythonPlanet Python·20w

    Localising xkcd

    A collection of localized versions of the famous xkcd 327 'Little Bobby Tables' comic, adapted for various European PyCon conferences in 2025. The localizations were created to illustrate SQL injection prevention using Python 3.14's new template strings (t-strings) feature during lightning talks at PyCon Italia, Greece, Estonia, Finland, and Sweden.

  8. 8
    Article
    Avatar of lobstersLobsters·20w

    PostgreSQL 18 RETURNING Enhancements: A Game Changer for Modern Applications

    PostgreSQL 18 introduces enhanced RETURNING clause capabilities with OLD and NEW aliases, allowing developers to capture both before and after states of data in INSERT, UPDATE, DELETE, and MERGE operations within a single atomic statement. This eliminates the need for separate SELECT queries, complex triggers, or application-level change tracking. The feature is particularly powerful for MERGE operations, enabling sophisticated upsert patterns with complete visibility into what changed. Practical examples demonstrate building audit trails, tracking inventory changes, and comparing values without additional database round trips or trigger overhead.

  9. 9
    Article
    Avatar of postgresPostgreSQL·20w

    Introducing pgpm: A Package Manager for Modular PostgreSQL

    pgpm is a new package manager for PostgreSQL that enables developers to share and reuse application-level database logic (schemas, tables, functions, policies, triggers) as modular, versioned packages. Unlike traditional PostgreSQL extensions that operate at the system level, pgpm works at the application layer using pure SQL, requiring no superuser access or compilation. It organizes code into workspaces with explicit dependency management, automatic resolution, and deterministic deployment order. The tool supports test-driven development with ephemeral databases and CI/CD integration, drawing inspiration from Sqitch while adding recursive composition and modular packaging capabilities.

  10. 10
    Article
    Avatar of depeszdepesz·20w

    Waiting for PostgreSQL 19 – Implement ALTER TABLE … MERGE

    PostgreSQL 19 introduces ALTER TABLE commands for merging and splitting partitions. The new MERGE PARTITIONS command combines multiple partitions into one, while SPLIT PARTITION divides a single partition into several. Both operations currently hold ACCESS EXCLUSIVE locks during execution, making them unsuitable for large tables under high load, but they provide a foundation for future optimizations with reduced locking and potential parallelism. These features were previously attempted in PostgreSQL 17 but were rolled back due to issues.

  11. 11
    Article
    Avatar of ploehploeh blog·18w

    Filtering as domain logic

    Complex database filtering logic can be split between server and client to balance performance and correctness. Keep simple, coarse-grained filtering in SQL queries for performance, while implementing precise filtering logic in the domain model where it's easier to test and maintain. This separation of concerns makes the filtering logic more testable through unit tests rather than slow integration tests, strengthens domain model contracts, and can improve cache hit ratios. The domain model should tolerate wider datasets and filter them down, ensuring correctness even if the database query is slightly imprecise.

  12. 12
    Article
    Avatar of lonely_programmerLonely Programmer·20w

    Laravel Pro Tip

    Instead of manually converting SQL insert statements into Laravel seeder syntax, you can load SQL files directly using `file_get_contents()` and execute them with `DB::unprepared()`. This approach saves time when seeding databases with existing SQL data.

  13. 13
    Article
    Avatar of clickhouseClickHouse·18w

    Christmas gifts from the ClickHouse engineering team

    ClickHouse 25.12 introduces several performance optimizations and UX improvements. Numeric hints now display for all rows in multi-value results when space permits. The distinctJSONPaths function is 50x faster by using metadata instead of scanning JSON columns. DISTINCT queries on LowCardinality columns now operate on dictionary IDs rather than full values, improving performance up to 6x. SEMI JOIN queries benefit from filter pushdown optimization, reducing data scanned by 30% and improving query speed by similar margins.

  14. 14
    Article
    Avatar of hnHacker News·17w

    Many Small Queries Are Efficient In SQLite

    SQLite handles many small queries efficiently because it runs in-process without network round-trips, unlike client/server databases. The N+1 query pattern, considered an anti-pattern in MySQL or PostgreSQL, works well with SQLite due to minimal latency per query. The SQLite website demonstrates this by executing ~200 SQL statements per dynamic page with sub-25ms response times. This approach enables better code separation and maintainability without performance penalties, allowing developers to choose between few complex queries or many simple ones based on their needs.

  15. 15
    Article
    Avatar of crunchydataCrunchy Data·18w

    Postgres Serials Should be BIGINT (and How to...

    PostgreSQL's SERIAL (INT) primary keys risk integer overflow at 2.1 billion rows, but migrating to BIGINT costs virtually nothing due to 8-byte memory alignment. The article provides a complete zero-downtime migration strategy using an atomic swap technique: add a new BIGINT column, backfill data in batches with regular vacuuming, create indexes concurrently, handle foreign key dependencies with NOT VALID constraints, then perform a millisecond metadata swap in a single transaction. Includes production-tested code examples and troubleshooting guidance.

  16. 16
    Article
    Avatar of motherduckMotherDuck·17w

    SQL Golf: 5 SQL Tricks You Should (Probably) Never Use

    SQL golf challenges developers to write the shortest possible queries. This article explores five extreme techniques from the Quackmas 2025 competition: column position references (#N), boolean math for counting (sum(condition)), the mode() function to replace GROUP BY/ORDER BY/LIMIT, comma join syntax, and DuckDB-specific shortcuts like FROM-first syntax and QUALIFY. While these tricks produced winning solutions as short as 36 characters, they sacrifice readability for brevity. Some techniques like mode() and QUALIFY are genuinely useful in production, while others like #N column references and whitespace elimination should stay in competitions.