Avoiding introspection queries for built-in array types
0xD09CD196D188D0B0 opened this issue · 0 comments
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
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?