Skip to content

Deno: pool has severe performance issues - very slow on 2nd request and onwards #3679

@maurictg

Description

@maurictg

At first, I thought it had to do with the ORM I was using: mikro-orm/mikro-orm#7782, but it turns out to be an upstream issue.

Reproduction:

import { Pool } from 'pg'

const pool = new Pool()

Deno.serve(async () => {
  await pool.query('select 1');
  console.timeEnd('q1');
  console.time('q2');
  await pool.query('select 1');
  console.timeEnd('q2');
  return new Response('ok');
});
deno run -A --env-file index.js

The first time the website loads, it returns within miliseconds "ok". The second request, (and third etc.) are EXTREMELY SLOW (like 10-20 seconds or even more).

Details:
node-postgres version: 8.21.0
Deno version: 2.8.0
OS: Linux
Database: Docker (postgres:alpine, latest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions