porsager / porsager/postgres

Transactions repeatedly query all types, causing significant delays.

Open
#952 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
8.7k
Forks
374
Avg merge
11d 16h
Merged PRs (30d)
1

Description

The delays we're experiencing in certain transactions are due to the 'fetch types' functionality, which runs the following query:

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-executes this query, and when we tried disabling it, we encountered the following error: PostgresError: malformed array literal: "". The delay caused by this query is over 200ms on our side.

Is there any way we can mitigate this delay without triggering errors?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Postgres.js “fetch types” functionality and the shown pg_catalog query, then trace how disabling that lookup causes the malformed array literal error. Determine a safe way to avoid repeating the query for every transaction, and verify both that the error is avoided and that the reported delay is reduced.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, postgresql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.