---
title: "Adding Async Streaming to Postgres Foreign Data Wrappers"
description: "Supabase Wrappers' ClickHouse foreign data wrapper now streams results asynchronously instead of fetching full result sets or fixed batches while blocking the Postgres backend."
url: "https://swe.quest/articles/adding-async-streaming-to-postgres-foreign-data-wrappers-200bc8dce10fc011"
canonical: "https://supabase.com/blog/adding-async-streaming-to-pg-fdw"
source: "Supabase"
published: "2025-12-04"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 4
tags: ["postgres","rust","concurrency","analytics"]
---

# Adding Async Streaming to Postgres Foreign Data Wrappers

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2025-12-04, 4 min read, Announcement. Original: [https://supabase.com/blog/adding-async-streaming-to-pg-fdw](https://supabase.com/blog/adding-async-streaming-to-pg-fdw)

## Summary

Supabase Wrappers' ClickHouse foreign data wrapper now streams results asynchronously instead of fetching full result sets or fixed batches while blocking the Postgres backend. A background Rust async task pulls rows from ClickHouse as they arrive and pushes them into a bounded channel (default 1024 rows). The Postgres backend reads from that channel synchronously, one row at a time, so memory stays bounded and the first rows come back sooner, even on billion-row scans. The pattern is reusable within Wrappers and will be extended to BigQuery, Snowflake, S3, Stripe and other connectors.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [Concurrency](https://swe.quest/tags/concurrency.md) (Compilers & runtimes)
- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)

## Prerequisites

- Postgres foreign data wrappers ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- Rust async/await ([easy posts on Rust](https://swe.quest/tags/rust.md?difficulty=easy))
- bounded channels

## Keywords

Supabase Wrappers, Foreign Data Wrappers, ClickHouse, postgres\_fdw

## Related posts

- [Supabase Wrappers v0.2: Query Pushdown & Remote Subqueries](https://swe.quest/articles/supabase-wrappers-v0-2-query-pushdown-remote-subqueries-4a8d4853bc0c2d1c.md): Supabase · 2023-12-14 · Medium · 4 min read · PostgreSQL, Databases, Rust
  Supabase Wrappers v0.2, a Rust-based Postgres foreign data wrapper framework for querying third-party sources with SQL, adds query pushdown, remote subqueries and per-FDW usage statistics.
- [Supabase Wrappers, a Postgres FDW framework written in Rust](https://swe.quest/articles/supabase-wrappers-a-postgres-fdw-framework-written-in-rust-284bf0f40798dcde.md): Supabase · 2022-12-15 · Medium · 9 min read · PostgreSQL, Rust, Data pipelines, Analytics & OLAP
  Supabase Wrappers is an alpha Rust framework, built on pgx, for writing Postgres Foreign Data Wrappers that expose external systems such as Stripe and Firebase as queryable foreign tables.
- [What's New in pg\_clickhouse - JSONB Support, SQL value functions, Streaming, and more](https://swe.quest/articles/what-s-new-in-pg-clickhouse-jsonb-support-sql-value-functions-streaming-and-more-ecb202cf6ff32298.md): ClickHouse · 2026-04-24 · Medium · 10 min read · PostgreSQL, Analytics & OLAP, Query engines, Memory management
  pg\_clickhouse, the Postgres foreign data wrapper for querying ClickHouse, now pushes down far more operations to ClickHouse.
- [Sync Stripe Data to Your Supabase Database in One Click](https://swe.quest/articles/sync-stripe-data-to-your-supabase-database-in-one-click-b7cbed62c6a06c5c.md): Supabase · 2025-12-19 · Medium · 5 min read · Payments & fintech, PostgreSQL, Data pipelines, SQL
  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.
- [Longbridge Technology simplifies their architecture and achieves 10x performance boost with ClickHouse](https://swe.quest/articles/longbridge-technology-simplifies-their-architecture-and-achieves-10x-e3a982c02b6e4b33.md): ClickHouse · 2025-03-17 · Medium · 8 min read · Analytics & OLAP, Databases, PostgreSQL, Payments & fintech
  Longbridge, a Singapore online brokerage, replaced a fragmented market-data stack of PostgreSQL (historical), Redis (real-time) and DynamoDB (high-write) with ClickHouse after evaluating it against TimescaleDB and TDengine for write throughput, Decimal support, time functions and aggregations.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
