porsager / porsager/postgres

Transactions always re-query all types leading to huge delay

Open
#903 3 comments 1 reaction 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

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.

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 transaction path that invokes the “fetch types” functionality and inspect the supplied pg_catalog query. Reproduce the delay and the malformed array literal error when that functionality is disabled; done means avoiding unnecessary repeated type queries without reintroducing the reported error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.