ClickhouseAlexey MilovidovTutorial
The day the sky emptied: rendering the FAA outage with ClickHouse FORMAT PNG
Summary
On November 13, 2026, an FAA outage grounded air traffic across the United States. The post visualizes the entire day over the lower 48 states using ADS-B data from adsb.exposed, which stores 380 billion position reports in a ClickHouse table sorted by a Z-order curve. The animation is rendered entirely by ClickHouse’s built-in FORMAT PNG output format, with no external plotting library or image-processing script. A SQL query aggregates positions by pixel and 5-minute frame, then returns rows that become the map, title, clock, timeline, and aircraft streaks colored by altitude and speed. The resulting animated PNG is 150 MB, reduced to 25 MB with a 256-color palette, and is also available as a GIF and MP4.
Context
On November 13, 2026, an FAA outage grounded air traffic across the United States. The post visualizes the entire day over the lower 48 states using ADS-B data from adsb.exposed, which stores 380 billion position reports in a ClickHouse table sorted by a Z-order curve for efficient spatial queries.
Approach / What changed
The post aggregates ADS-B position reports in ClickHouse by pixel and 5-minute frame, then renders the result as an animated PNG using ClickHouse’s built-in FORMAT PNG output format. The animation layers a ghost of the day’s traffic, current aircraft colored by altitude and speed, a timeline bar chart, and text rendered from a bitmap font stored in a map literal. The final APNG is converted to GIF and MP4 with ffmpeg.
Takeaways
ClickHouse’s FORMAT PNG output format can render animated images directly from SQL queries, using column names r, g, b for RGB and a t column for frames.
The Z-order curve (mortonEncode) on precomputed Web Mercator coordinates makes spatial range queries on 380 billion rows efficient by clustering nearby points in the primary key.
The animation layers a ghost of the day’s traffic, current aircraft, a timeline bar chart, and text rendered from a 3x5 bitmap font stored in a map literal, all as rows of the same result set.
FAQ
How many rows does the aggregation query return?
The query reads 42.5 million positions and returns 9 million rows, one per pixel that saw at least one aircraft in any of the 288 frames. The public endpoint limits results to about a million rows, so the query runs 24 times, once per hour, and the results are aggregated locally.
How does memory usage work for animated PNGs?
By default, FORMAT PNG keeps every frame in memory until the query ends, requiring about 1.2 GB for 288 frames. With output_format_image_streaming_animation = 1, it writes each frame as soon as t advances and keeps only one frame in memory, but the frame count in the header becomes an upper bound that some decoders complain about.
How does FORMAT PNG determine colors and frames?
The color mode is determined by column names: r, g, b for RGB, r, g, b, a for RGBA, or v for grayscale. Integer x and y columns place each row on the canvas; otherwise rows fill pixels in scanline order. A t column creates an animated PNG with one frame per t value, and the frame duration is set by output_format_image_time_multiplier_seconds and output_format_image_time_divisor_seconds.
Source and freshness
- Source
- clickhouse.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.