Search code examples
postgresqlpgpool

PostgreSQL Default Result Limit


I'm using Grafana and PostgreSQL 13 for visualizing. There are many users in the Grafana and they could send queries to their own databases.

I need to set a default result limit for sent queries. (Like 1000) But I couldn't find a solution. I analyzed the PgPool to rewrite the query but I think it couldn't do that.

Is there any solution for that? I'm not sure but maybe I need a TCP Proxy which can do.


Solution

  • The most popular solution, as far as I know, is PgBouncer. PgBouncer is a lightweight connection pooler for PostgreSQL. It acts as a Postgres server, so simply point your Grafana and other clients to the PgBouncer port.

    Here are some installation guides for Linux (Ubuntu, Debian, CentOS):