Skip to content

Optimize PostgreSQL connection handling (introduce pooling or shared connection) #17

@snabo1988

Description

@snabo1988

Problem

The current implementation creates a new PostgreSQL connection for each query
via psycopg2.connect().

While acceptable for early development, this may become inefficient under load
and should be optimized.

Current State

  • get_connection() opens a new DB connection on every call
  • No connection reuse or pooling is used

Proposed Improvements

  • Introduce connection pooling (e.g. psycopg2.pool or similar)
  • Or maintain a shared connection managed by the application lifecycle

Notes

This is not critical for MVP correctness but should be addressed before
production or higher load scenarios.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions