MagicStack / MagicStack/asyncpg

Avoiding introspection queries for built-in array types

オープン
#1,272 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
8.1k
フォーク
468
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi, and thanks for all the work on asyncpg! 👋

I’ve noticed that fresh connections usually emit introspection queries even for statements involving simple arrays of integers.

Looking at the code in init_array_codecs, asyncpg seems to initialize only the core codecs for _oid and _text (as mentioned in the comment, “to make type introspection query work”).

https://github.com/MagicStack/asyncpg/blob/5b14653e0b447d956aa01ec658562138e19f0293/asyncpg/protocol/codecs/array.pyx#L861-L875

I was wondering: was there a particular reason that asyncpg doesn’t include more built-in types there? From my perspective, types like _int2, _int4, _int8, _float4, _float8, _bool, and _char are very commonly used in queries. Including them might avoid a lot of introspection queries on new connections.

Is this something that could be considered, or are there trade-offs I might be missing?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

asyncpg/protocol/codecs/array.pyx から始め、特に init_array_codecs と 861-875 前後の関連する行を確認してください。_oid と _text がどのように初期化されるかを確認し、次に列挙されている組み込み配列型を評価して、それらを含めることで、issue で提起されたトレードオフなしにイントロスペクションクエリを回避できるかどうかを検討してください。明確な判断と、適切な変更または文書化された根拠があれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
postgresql, python
領域
databases
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。