GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support Min connection pool parameter · Issue #3009 · brianc/node-postgres

Support Min connection pool parameter #3009

New issue
Copy link
New issue
Copy link
Open
Open
Support Min connection pool parameter#3009
Copy link

Description

@Smriti-OSS
Smriti-OSS
opened on Jun 13, 2023
Issue body actions

Hey @brianc @charmander ,

Problem Statement: I have an application which is currently using the default configuration of node-postgres pool to connect to postgres. I have noticed that whenever we query the application - node-postgres connection pool always creates a new connection and so the total time taken for query execution is always between 3-5sec. If we re-use an idle connection for query execution - it just takes 2 millisecond to 300 millisecond.

Proposed Solution: I am thinking of keeping some idle connections in the pool - so that they could be used whenever the database is queried. Something like this -

let pool = new Pool({
        database: connectionConfig.database,
        port: connectionConfig.port,
        user: connectionConfig.user,
        password: connectionConfig.password,
        host: connectionConfig.host,
        min: 1,
        max: 10
    });

I am open to submitting a PR for the above feature but thought of first discussing it with the community whether this would be a feature worth exploring.

Reacted by blake, scottravio, Bradley B. Smith, Kashif Khan, Jesse Niininen, Jacob Emil Ulvedal Rosborg, benibenn, khoirul amri, Shogo Otake, ajaykrishnan33 and 5 more

Activity

  1. khoirulamri commented on Jan 12, 2024

    @khoirulamri
    khoirulamri
    on Jan 12, 2024
    More actions

    I experienced the same problem. each initial set of connections takes more than 200 ms, so the api response time becomes > 1s

    Reacted by francesco
  2. capJavert commented on Oct 22, 2024

    @capJavert
    capJavert
    on Oct 22, 2024
    More actions

    @brianc we are working with pg-pool and would really benefit from this option. My question is, is there any issue on driver level that would block implementing something like that?

    I took a brief look at the code and it seems like it should be possible as an addition to pool logic. Would offer to contribute as well 🙌

    Reacted by francesco, andymel and KieranJeffreySmart
  3. htrajan commented on Apr 24, 2025

    @htrajan
    htrajan
    on Apr 24, 2025
    Contributor
    More actions

    I took a crack at addressing this. Would love to get your thoughts @brianc @charmander.

  4. brianc
    added a commit that references this issue on Apr 25, 2025

    Support Min connection pool parameter #3009 (#3438)

    ff40638
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.