-
Notifications
You must be signed in to change notification settings - Fork 431
Description
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”).
asyncpg/asyncpg/protocol/codecs/array.pyx
Lines 861 to 875 in 5b14653
cdef init_array_codecs(): | |
# oid[] and text[] are registered as core codecs | |
# to make type introspection query work | |
# | |
register_core_codec(_OIDOID, | |
<encode_func>&arrayoid_encode, | |
<decode_func>&arrayoid_decode, | |
PG_FORMAT_BINARY) | |
register_core_codec(_TEXTOID, | |
<encode_func>&arraytext_encode, | |
<decode_func>&arraytext_decode, | |
PG_FORMAT_BINARY) | |
init_array_codecs() |
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?