Hints and hazards: pg_plan_advice in PG19
Postgres 19 adds two contrib modules for query hints: pg_plan_advice, which applies advice per session via SET, and pg_stash_advice, which attaches advice to specific query identifiers.
Topics Languages
Writing or optimizing SQL queries, SQL dialects.
Postgres 19 adds two contrib modules for query hints: pg_plan_advice, which applies advice per session via SET, and pg_stash_advice, which attaches advice to specific query identifiers.
Star Trek: The Next Generation scenes where the crew queries the ship's computer were re-enacted using Claude as a natural-language-to-SQL translator over a synthetic DuckDB database built so that correct queries reproduce the on-screen answers.
A single lateral-join query answering "who's on call for this rotation layer right now" consumed 34% of incident.io's Postgres replica CPU.
ClickHouse's built-in FORMAT PNG output renders an animated map of the November 13, 2026 FAA outage directly from SQL, with no plotting library.
TimesFM 3.0, a pretrained time-series foundation model, can be called from ClickHouse SQL via executable Python UDFs that forward arrays to an HTTP model server, giving zero-shot forecasts and anomaly scores without per-series training.
A one-afternoon workshop pipeline uses DuckDB to find Amazon appliance products whose ratings fell most in the last six months across 2.1 million reviews, then sends only the 40 most helpful recent complaints to an LLM that groups them into themes with safety issues first.
ClickHouse's DataLakeCatalog engine connects to Amazon S3 Tables through the Iceberg REST endpoint, exposing a table bucket as a ClickHouse database that can be queried in place and written back to, with no data copied out.
DuckDB stores data by column and processes it in vectors of 2,048 values, which drives its compression, projection pushdown and aggregation speed.
ClickHouse 26.10 ships 104 features, 225 performance optimizations and 739 bug fixes.
Data engineer Matt Martin traces his path from copy-pasting Excel reports through Teradata, BigQuery and heavyweight Spark clusters to DuckDB, which let him query local CSVs, S3 Parquet files and Iceberg tables in a few lines of SQL with no JVM or cluster.
Jev, a typed classifier model returning calibrated answers in 70-500 ms, was applied to the Agentic Analytics Benchmark for two jobs: labeling failed text-to-SQL agent runs and ranking warehouse tables per question.
DuckDB 2.0.0 LTS includes a set of smaller features beyond its headline items.
Five new models (GPT-6 Astra, Luna, Sol, Claude Opus 5.5 and Claude Sonnet 5.5) were added to a frozen 201-question agentic text-to-SQL benchmark over a synthetic ClickHouse warehouse.
GitHub replaced identity-bearing stargazer pagination with an aggregate star-history endpoint that returns up to 30 weeks of daily star counts per request, with no usernames attached.
pg_clickhouse v0.11.0 and the chdb extension v0.1.2 improve Postgres–ClickHouse type compatibility.
ClickHouse 26.9 ships 56 new features, 135 performance optimizations and 464 bug fixes.
ClickHouse's beta AI Functions call LLM and embedding providers directly from SQL.
MySQL has no native Parquet import, but clickhouse-local can read a Parquet file over HTTP with the `url` table function and write it straight into a MySQL table via `INSERT INTO FUNCTION mysql(...)`.
ClickHouse 26.8 is a long-term support release with 98 new features, 128 performance optimizations and 556 bug fixes.
ClickHouse 26.8 can serve a parameterized HTTP API directly, removing the thin API layer often placed in front of it.
ClickHouse 26.8 adds pipelined SQL via a `|>` operator that lets queries be written as a sequence of transformations (FROM, WHERE, AGGREGATE, EXTEND, ORDER BY, LIMIT), building on the FROM-first syntax available since 22.12.
A real-time tick data app can stream stock trades and quotes from Massive (formerly Polygon.io) over WebSockets straight into ClickHouse, with a Node.js backend and a React frontend for live visualization.
data-agent-mnist is an open harness for benchmarking agentic analytics, built from 201 real questions from ClickHouse's internal agent DWAINE and replayed against a deterministically seeded, anonymized synthetic reconstruction of their dbt warehouse (18 tables, 865 columns).
Repeated DELETE FROM + COPY snapshot reloads in Amazon Redshift left some tables with up to 90% ghost rows, about 22 billion rows on disk for 2.4 billion live ones.
Postgres SELECT DISTINCT always scans every index entry matching its predicates, so its cost grows with total matching rows rather than with the number of distinct values.
incident.io built an internal "data brain" agent that answers business questions against BigQuery by encoding institutional analyst knowledge rather than relying on raw text-to-SQL.
ClickHouse can serve as the historical tier (HDB) of a market data system, a low-risk place to adopt a new database.
ClickHouse 26.6 ships 56 features, 79 performance optimizations and 366 bug fixes, marking ten years of ClickHouse as open source.
Artemis, an AI-native threat detection platform ingesting terabytes of logs daily, sped up its ClickHouse Cloud workload with three techniques.
Lyft built a Metric Semantic Layer (MSL), a versioned Python package that stores each company-wide "Golden Metric" as YAML metadata plus Jinja-templated SQL, so a definition is updated once and flows to every downstream consumer.
ClickHouse 26.5 ships 38 features, 51 performance optimizations and 224 bug fixes.
Executable UDFs are in public beta on ClickHouse Cloud: you upload a zipped Python function with its model files, and ClickHouse runs it in a pool of long-lived sandboxed processes that can be called from SQL, including inside materialized views.
ClickHouse's SAMPLE clause runs aggregations over a deterministic subset of rows selected by a hash-based sample key, which must be part of the primary key so granules above the hash threshold can be skipped.
ClickStack's April 2026 release adds alerts driven by arbitrary ClickHouse SQL, so rolling baselines and standard-deviation anomaly checks can be written with window functions and fire when the query returns 1.
ClickStack now supports charts and alerts defined by arbitrary ClickHouse SQL, going beyond what predefined query builders can express.
ClickHouse's Join table engine keeps a precomputed in-memory hash map for a fixed join strictness, type and key.
Turso 0.6 is the first release supporting all major SQLite features, adding experimental multi-process WAL access (OFD locks on Linux, fcntl elsewhere, IOCP on Windows) and VACUUM/VACUUM INTO.
ClickHouse 26.4 ships 39 features, 45 performance optimizations and 238 bug fixes, led by SQL-compatibility additions: VALUES as a table expression with column aliases, PostgreSQL-style EXTRACT units, SET TIME ZONE, NATURAL JOIN and compound INTERVAL literals.
ClickStack's March 2026 update reworks Event Deltas for root-cause analysis.
mssql-python, Microsoft's Python driver for SQL Server and Azure SQL, now accepts both DB-API qmark (?) and pyformat (%(name)s) parameter styles, choosing between them by whether a tuple/list or a dict is passed.
ClickHouse 26.3 ships 27 features, 40 performance optimizations and 202 bug fixes.
Ten practices for getting performance and storage efficiency out of ClickHouse, each measured on a 150M-row Amazon reviews dataset.
ClickHouse now queries Apache Iceberg and Delta Lake tables in place on S3, GCS and Azure, either directly or through catalogs such as AWS Glue, Unity, Polaris, BigLake, OneLake and Iceberg REST.
A Postgres `INSERT ... ON CONFLICT DO UPDATE ... WHERE` upsert still locks the conflicting row even when the WHERE clause blocks the update.
ClickHouse's datetime functions cover rounding, filtering and duration calculations, demonstrated on about 3 million NYC taxi trips. toStartOfHour and toStartOfFifteenMinutes bucket timestamps, casting to ::Time groups or filters by time of day across all dates, and dateDiff computes trip durations to derive average speed, which falls from about 19 mph at 6am to about 11 mph by 8:30am. countIf with toDayOfWeek splits weekday and weekend trips, and the lag window function computes percentage change between windows. formatDateTime and bar make the output readable.
ClickStack speeds up ClickHouse for observability by generating and rewriting queries to fit how the engine stores, prunes and processes data, instead of passing raw SQL through.
ClickHouse offers five main routes for turning raw values into Date/DateTime types. `fromUnixTimestamp` and its 64Milli/64Micro variants convert epoch timestamps to `DateTime` or `DateTime64(3/6)`.
ClickStack's February 2026 update adds ClickStack resources (dashboards, alerts, sources, webhooks) to the ClickHouse Cloud OpenAPI for configuration-as-code, embeds the ClickStack UI in the ClickHouse 26.2 binary at /clickstack for about 4.1 MB, and introduces a raw SQL mode for table visualizations with injected time-range parameters, enabling joins across logs and traces.
ClickHouse's geospatial support has grown from early distance functions to over 90 functions, grid indexes (geohash, H3, S2), and geometry types (Point, Ring, LineString, MultiLineString, Polygon, MultiPolygon) implemented as aliases over Tuple and Array.
ClickHouse 25.12's new HMAC function lets a ClickHouse HTTP endpoint verify webhook signatures directly in SQL.
The Fivetran destination for ClickHouse Cloud is now in beta and adds History Mode, which implements SCD Type 2 by inserting a new row per change with _fivetran_active, _fivetran_start and _fivetran_end columns, enabling point-in-time snapshots, change tracking and audit queries.
On Figma's billing infrastructure, data science work centered on making a complex, stateful system legible and correct rather than on experiments.
ClickHouse 25.12 ships a batch of end-of-year improvements, from client usability tweaks (digit-group highlighting in the prompt, per-row readable numeric hints) to query engine optimizations. distinctJSONPaths now merges per-part JSON path metadata instead of decoding column data, cutting a 10M-row BlueSky query from 4.56 s to 82 ms. DISTINCT on LowCardinality columns now works on dictionary IDs with early exit, typically 2-6x faster, but slower on a sorting-key column where unique values are spread across the whole table.
Chartmetric moved time-series and playlist workloads from Postgres and Snowflake to ClickHouse Cloud, cutting RDS storage from 28 TB to 18 TB and bringing queries that timed out at 60 seconds down to under 3 seconds.
All 12 Advent of Code 2025 puzzles are solved in pure ClickHouse SQL, each as a single query that parses the raw input and computes both parts with no UDFs, temporary tables or preprocessing.
ClickStack's HyperDX UI can now use ClickHouse Incremental Materialized Views registered against a source to accelerate charts, searches, histograms and dashboards, even when filters are applied.
ClickHouse added 119 SQL functions across its 2025 releases, and the system.functions table's introduced_in column can be queried to list and count them per version.
Supabase now offers a one-click Stripe Sync Engine integration that copies Stripe customers, subscriptions, invoices and payments into real Postgres tables, kept current via webhooks plus scheduled backfills run through pgmq-based Supabase Queues and Edge Functions with retries.
pg_clickhouse v0.1.0 is an Apache 2-licensed PostgreSQL foreign data wrapper, derived from clickhouse_fdw, that runs analytics queries on ClickHouse from Postgres so existing queries can work unmodified by changing search_path.
ClickStack's November release adds beta Service Maps, root span filtering, configurable highlighted attributes and trace attributes, native incident.io alert routing, Lucene search inside the trace waterfall, and previous-period overlays on line charts.
StockHouse is a reference streaming analytics app that ingests live stock and crypto ticks from Massive's WebSocket APIs through a Go ingester into ClickHouse and renders them in a Vue dashboard built on Perspective.
ClickHouse 25.10 focuses on JOIN performance, adding lazy columns replication (an index column pointing at the original data instead of copying duplicated values), runtime Bloom filters built from the right-side join keys and applied as PREWHERE on the left side for parallel hash joins, push-down of OR conditions that reference both join sides, and automatic column statistics via auto_statistics_types to feed join reordering.
Weather can be inferred from ADS-B airplane telemetry stored in ClickHouse by comparing air-relative and ground-relative measurements.
Vehicle attachments in a fleet (trucks pulling trailers) are modeled as a time-variant DAG in a single Postgres table of edges with validity intervals and a source-authority priority.
ClickHouse's DataLakeCatalog database engine connects to lakehouse catalogs such as AWS Glue and Databricks Unity Catalog, reads their metadata, and automatically maps each table to the matching Iceberg or DeltaLake table engine.
Etsy replaced the 13 hard-coded segmentations in its Catapult experimentation platform with experimenter-defined ones, each modeled as a SQL query that assigns segment values plus a set of approved join columns.
ClickHouse 25.9 adds automatic global join reordering, which uses a greedy algorithm plus row-count estimates or manually created column statistics to pick build/probe order across many tables.
A Kalman Filter can run entirely inside Postgres to smooth noisy GPS tracks, with per-device state (estimate plus covariance matrix) kept in a devices table and a kalman_step SQL function applying predict/update steps that can use HDOP or speed.
ClickHouse built a crash-deduplication pipeline for its CI that groups similar stack traces from fuzzing, stress and functional tests using the TraceSim similarity method, implemented almost entirely in ClickHouse SQL.
ClickStack's August 2025 update brings the HyperDX UI to ClickHouse Cloud in private preview with passwordless auth, leaving only the OTel collector to self-host.
Turso 0.1.3 adds read-only `ATTACH DATABASE`, letting a single session join across multiple SQLite databases without SQLite's default limit of 10 attached databases (hard maximum 125).
Meta's Policy Zones, part of its Privacy Aware Infrastructure, applies information flow control to enforce purpose limitation across an exabyte-scale data warehouse.
pg_cron stores scheduled jobs as raw SQL text, separate from Postgres' system catalogs, so dropping a table leaves jobs that fail every run with "relation does not exist" and fill cron.job_run_details with errors.
CoalescingMergeTree, new in ClickHouse 25.6, consolidates sparse partial-row inserts during background merges by keeping, per sorting key and per column, the latest non-null value as determined by insertion order rather than a timestamp.
Tennis scoring logic can be encoded as ClickHouse SQL user-defined functions that compute how many points each player needs to win a match, then applied to Wimbledon point-by-point data to show Alcaraz was never close to losing his five-set first-round match against Fognini.
Replacing fact-to-dimension joins with in-memory dictionaries in ClickHouse Cloud sped up a 17-query join benchmark over 1.4 billion rows by 1.9–3.5× in total runtime, up to 6.6× on individual queries, and cut cost by up to 60%.
The Cornell Lab of Ornithology's eBird dataset of 1.5 billion bird observations (a 58 GB zip holding a 440 GB CSV) can be loaded into ClickHouse and visualized on the adsb.exposed interactive map. clickhouse-local queries the CSV inside the zip with schema inference.
A simple S3-like file server can be built inside Postgres by storing binary data in a BYTEA table and exposing it through PostgREST's functions-as-RPC via the Neon Data API.
ClickHouse 25.4 adds lazy materialization, which defers reading column data until it is needed.
The Foursquare open places dataset (about 100 million records) loads straight from S3 Parquet into ClickHouse in 42 seconds and 11 GB.
Postgres Language Server is an LSP implementation for Postgres offering autocompletion, syntax error highlighting, type-checking via PREPARE/EXPLAIN against a live database, and a Squawk-inspired linter, available for VSCode, Neovim and as a CLI.
Incremental materialized views feeding AggregatingMergeTree tables cut ClickHouse dashboard queries over 4+ billion Bluesky JSON documents (1.6 TiB) from 44–56 seconds to 3–7 ms. Partial aggregation states are computed only for newly inserted rows and merged in the background, so the pre-aggregated tables stay tiny (e.g. 892 rows, 11 KiB) and constant-size regardless of source growth.
Postgres CDC into ClickHouse (via PeerDB or ClickPipes) uses logical decoding and maps tables to ReplacingMergeTree.
The pgRouting extension, usually paired with PostGIS for geospatial shortest-path queries, can serve as a lightweight graph layer in Postgres instead of Apache AGE or Neo4j.
Testing against SQLite when production runs Postgres gives false confidence.
BuzzHouse is a new ClickHouse fuzzer that generates complex but mostly semantically valid SQL backed by a tracked catalog of tables, filling a gap left by SQLsmith, SQLancer, the AST fuzzer and WINGFUZZ.
Evidence.dev builds dashboards from SQL and markdown, running queries at build time rather than at request time.
ClickHouse 24.12 adds LIKE and unknown-value equality/IN support for Enums, an experimental descending MergeTree sorting key, JSON subcolumns as primary key columns, Iceberg REST catalog (Unity, Polaris) and schema evolution support, and automatic JOIN side swapping via query_plan_join_swap_table.
A Medallion pipeline (Bronze, Silver, Gold) in ClickHouse ingests and cleans the high-volume Bluesky Jetstream feed, which arrives with malformed JSON, inconsistent and invalid timestamps, recursive structures and frequent duplicates.
A Cal.com Foreign Data Wrapper, built on Supabase's Wasm-based Wrappers framework, lets Postgres read Cal.com event types and bookings and create bookings with a plain INSERT, so a signup and its calendar booking can happen in one transaction.
PostgreSQL automatically indexes primary keys and UNIQUE columns but not the referencing column of a foreign key, so lookups on that side and ON DELETE CASCADE / SET NULL triggers fall back to full table scans.
Slow ClickHouse queries can be diagnosed with system.query_log (duration, rows read, memory, CPU, cache metrics) and the EXPLAIN statement, illustrated on the NYC Taxi dataset in the ClickHouse Playground.
Postgres and SQL Server share SQL but differ in dialect details that trip up migrating developers.
ClickHouse 24.11 makes parallel hash join the default join algorithm, building several hash tables concurrently for speed at the cost of more memory, and adds zero-copy block scattering between threads.
ClickHouse's in-house product analytics platform, Galaxy, stores over 20 billion events (14 TB, roughly 14x compression) in a single denormalized MergeTree table keyed on created_at.
Aggregating analytics across a database-per-tenant SQLite architecture works with a simple daily ETL job: discover tenant databases via the Turso Platform API, run a per-database query for daily orders, revenue, active carts and new products, and upsert the results into a central metrics table keyed by date and database name.