-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transactions always re-query all types leading to huge delay #903
Comments
Types are only fetched at first connect. Are you running on some edge host? You can disable with fetch_types: false |
@porsager Hey, this is not running on an edge host. The problem is, disabling fetch_types throws some exceptions as it can't resolve a type from an array it seems. It seems to be re-fetching the types on each connection in the pool, so when I have a lot of transactions and it grabs different connections, it will indeed re-fetch the types.
^ The README explains that behavior, except the part that it re-fetches all types. Is there any possible way to cache the types? We have a ton of concurrent queries as it's an gameserver, it not caching and re-fetching the types is quite time consuming as we have a big database. We noticed high delays on a big player count (stuff that requires knowing array types, as that plays a role) and when we had a lot of concurrent queries going on at startup which was eating some seconds of boot time. |
https://github.com/porsager/postgres/blob/master/src/connection.js#L743 This seems to be it, as |
Hey,
We're noticing big delays on certain transactions, we tracked it down to be the 'fetch types' functionality that queries
select b.oid, b.typarray from pg_catalog.pg_type a left join pg_catalog.pg_type b on b.oid = a.typelem where a.typcategory = 'A' group by b.oid, b.typarray order by b.oid
.Each transaction re-fetches the types, disabling that feature however threw errors:
PostgresError: malformed array literal: ""
Is there anything we can do against this delay? It delays them by 200ms+ on our side.
The text was updated successfully, but these errors were encountered: