Feature Request: Allow for libpq pipeline mode
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
調査の方向性
Start by tracing how postgres_execute handles query parameters and why its prepare=FALSE path throws, then compare that with libpq pipeline mode. The issue proposes a new postgres_execute_pipeline function for batches of parameterized statements, but leaves API design and implementation scope open. Done would mean agreeing on the approach and supporting statement-level results or errors.
索引モデルが issue の本文から書いたものです。
説明
Hi 👋 I've been reading through the roadmap of the ducklake project where the reduction of the number of round trips is showing up.
Originally, I've contributed https://github.com/duckdb/duckdb-postgres/pull/647 before, with the intention to suggest to hide encryption keys in query parameters to the ducklake project, but it seems that those cause four round trips instead of one, which would oppose a central goal of the project.
This brought me to the existing pipeline mode in libpq, its idea to simply send multiple statements with or without query parameters. However, in order to use it most efficiently, I think we'd need to open a statement with prepare=FALSE to have query parameters.
I'm sure you've had multiple sessions already about those round trips, thus I want to highlight that my thoughts here might be premature and at risk of hitting glass ceilings quickly, that are hidden to me, but obvious to you. I mean, I've already noticed that the prepare=FALSE path was equipped with a throw, thus there was some decision in the past against this combination.
Suggestion
Introduce a new function postgres_execute_pipeline which allows to send batches of statements with parameters that are sent without preparing them beforehand instead of joining query literals into a single string as done in ducklake:
FROM postgres_execute_pipeline('pg', [
{'query': 'SET LOCAL extra_float_digits = 3', 'params': []},
{'query': 'INSERT INTO "lake".ducklake_snapshot VALUES ($1, clock_timestamp(), $2, $3, $4)', 'params': ['2', '1', '2', '1']},
... -- cut off for simplicity
]);
instead of a single string inside a CALL postgres_execute('__ducklake_metadata_lake', '<the string below>', prepare=FALSE);
SET LOCAL extra_float_digits = 3;
INSERT INTO "lake".ducklake_snapshot VALUES (2, clock_timestamp(), 1, 2, 1);
...
I see that this is not improving on the round trip problem per se, but I feel like it enables a way forward in some other dimensions:
- efficient: keep the minimal network interaction
- elegant: enable query parameters
- observable: results/errors/metrics per statement
I guess my punchline being that we could gain something here without losing out on your existing ambitions of using stored procedures in postgres in general and might widen the use-cases the postgres extension can serve.
I'd be happy to learn about your thoughts about any kind of optimization in that regard or in general. The example here is tied to the ducklake project, but I'd argue it would apply in general. Of course, I'd feel more than happy to get my hands dirty or trying to compile some more evidence 🙃
- 主要言語
- C++
- スター
- 380
- フォーク
- 122
- 平均マージ
- 2時間 17分
- マージ済み PR(30日)
- 18
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
duckdb/duckdb-postgres のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
duckdb/duckdb-postgres#664 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
duckdb/duckdb-postgres#639 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
duckdb/duckdb-postgres#638 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
duckdb/duckdb-postgres#628 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
duckdb/duckdb-postgres#623 ·
メンテナーはふだん 1 日以内に返信
duckdb/duckdb-postgres の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
component: tabs platform: macOS
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
zen-browser/desktop#16860 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
windirstat/windirstat#776 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
godotengine/godot#125913 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100