用 Postgres 查询
Query analytics bucket data directly from Postgres using SQL.
一旦你的数据通过自己的采集管道流入分析桶,你就可以直接用标准 SQL 在 Postgres 上查询它。
🌐 Once your data flows into an analytics bucket through your own ingestion pipeline, you can query it directly from Postgres using standard SQL.
这是通过 Iceberg Foreign Data Wrapper 实现的,它在你的 Postgres 数据库和 Iceberg 表之间创建了一座桥梁。
🌐 This is made possible by the Iceberg Foreign Data Wrapper, which creates a bridge between your Postgres database and Iceberg tables.
关于摄入
通过 Supabase Pipelines 将数据复制到分析桶不再受支持。本指南假设你的分析桶是通过你自己的数据采集管道来填充的。
🌐 Replication into Analytics Buckets via Supabase Pipelines is no longer supported. This guide assumes your Analytics Bucket is being populated by your own ingestion pipeline.
设置概览 #
🌐 Setup overview
你有两个选项可以启用查询:
🌐 You have two options to enable querying:
- 仪表板界面(推荐)- 通过 Supabase 仪表板简化设置
- 手动安装 - 使用 SQL 和配置来安装封装器
通过仪表板界面安装 #
🌐 Installing via Dashboard UI
这个仪表板提供了最简单的设置体验:
🌐 The dashboard provides the easiest setup experience:
- 在 Supabase 仪表板中导航到你的 分析桶 页面。
- 找到你想查询的命名空间,然后点击 用 Postgres 查询。

- 输入你想创建外部表的 Postgres 模式。

- 点击 连接。封装器现在已配置好。
查询你的数据 #
🌐 Querying your data
一旦安装了外部数据封装器,你就可以用标准 SQL 查询你的 Iceberg 表了:
🌐 Once the foreign data wrapper is installed, you can query your Iceberg tables using standard SQL:
1select *2from schema_name.table_name3limit 100;常见查询示例 #
🌐 Common query examples
获取最新活动:
🌐 Get the latest events:
1select event_id, event_name, event_timestamp2from analytics.events3order by event_timestamp desc4limit 1000;与交易数据关联:
🌐 Join with transactional data:
1SELECT2 e.event_id,3 e.event_name,4 u.user_email5FROM analytics.events e6JOIN public.users u ON e.user_id = u.id7WHERE e.event_timestamp > NOW() - INTERVAL '7 days'8LIMIT 100;手动安装 #
🌐 Manual installation
对于高级用例,你可以手动安装并配置 Iceberg 外部数据封装器。有关详细说明,请参阅 Iceberg 外部数据封装器文档。
🌐 For advanced use cases, you can manually install and configure the Iceberg Foreign Data Wrapper. See the Iceberg Foreign Data Wrapper documentation for detailed instructions.