Connection to PostgreSQL very slow

I have a actual Debian Bullseye server (without any desktop environment) with Grafana v8.3.3 and MariaDB on it. Additional I installed PGadmin Server to inspect the data of my remote PostgreSQL (V11) database. If I connect to this with PGadmin it’s connecting fast and also queries are done in a normal time.
But if I create a connection with Grafana by using the same credentials everything is extremely slow. The connection test takes over 1 minute. It’s reporting then a success, but off course I can’t create a query with this performance - it runs in a timeout.
I fond a interesting point at Grafana-Log in this context:

t=2022-01-07T12:03:19+0100 lvl=eror msg="query error" logger=tsdb.postgres err="dial tcp connect: connection timed out"

This IP is not a IP of my systems. Everything is on another private network. I can’t find any setting with this IP at the config-files.
Maybe this is the problem, but how can I fix it? Or is there a incompatibility with PGadmin on the same server?


As I know, pgadmin have limit in the query result. In grafana the query depend on the time frame of the dashboard, and the limit is depends on it. It probably query a lots of rows and make it timeout to the database.
Perhaps you need to consider how the query running in the grafana, also it’s little bit tricky if using RDBMS as datasource regarding the resultset of the time series query in grafana.

Fadjar Tandabawana

Thanks Fadjar,

I have 3 of this combinations, and the others don’t have this problems. So I think this is not a general problem. The other 2 systems are Debian buster and I did a update on one of them. Also no problems. So I think as next step I clone this one and test it on the 3rd location.


Ok, now I replaced the problematic server with a clone of the running one. And it works fast. So I think there was something wrong at the other installation - but I don’t know what it was. But for me the problem is solved. I’ve had only to delete some configurations from the server.