简体   繁体   中英

'Too many connections' created in postgres when creating a dashboard in Pentaho

I was creating a Dashboard in Pentaho PUC which uses a postgres connection as the data source. Most of the time this causes the postgres to say

Too many clients already in Postgres'


SHOW max_connections; Query shows maximum connections of 200

I used this query select * from pg_stat_activity; . From that 90% of connections are from the Pentaho server to the database I use as the datasource in my new dashboard. waiting is f and state is idle in most of the connections. This looks like Pentaho is creating too many connections. How can I limit or Control it? I have already tried increasing connection limit from default 100 to 200 from postgres side but still the issue is there.

From the comments thread on the original question it seems you're using SQL over JDBC connections on your dashboard. This will create a different database connection for each query that needs to run and if they are somewhat slow you may reach the limit on the number of concurrent connections.

Instead, you should set up a JNDI: on your datasource management window add a new connection and set up the correct credentials. Under advanced options set up a connection pool. Give it a meaningful name. From that point on, you should refer to that name on your dashboard queries and use SQL over JNDI instead of SQL over JDBC. This way each SQL query will get a connection from the connection pool and the DB only sees 1 connection at each time, despite running multiple queries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM