Home / Companies / Supabase / Blog / Post Details
Content Deep Dive

Adding Async Streaming to Postgres Foreign Data Wrappers

Blog post from Supabase

Post Details
Company
Date Published
Author
Bo Lu
Word Count
714
Language
English
Hacker News Points
-
Summary

The text discusses the development and implementation of asynchronous streaming capabilities for Foreign Data Wrappers (FDWs) in PostgreSQL, particularly in the context of integrating with analytical systems like ClickHouse. Traditional FDWs operate in a synchronous, batch-oriented manner, which can lead to high memory usage, poor interactivity, and inefficient resource utilization due to blocking during data fetches. To address this, a new approach using Rust's async runtime has been introduced, allowing FDWs to stream data incrementally through a bounded channel, which maintains predictable memory usage and improves query responsiveness by delivering results as soon as data becomes available. This innovation transforms FDWs into components suitable for modern data pipelines, enabling PostgreSQL to efficiently query remote data sources with low latency and scalability, and positions Wrappers as a universal data gateway within the SQL ecosystem.