Metabase sending a lot of queries - set application name

Hello,

I'm new here so please be delicate :sweat_smile:
I'm using Metabase v 0.36.4 (docker container) and I configured only one database in Admin > Databases. I also configured additional options for JDBC like "prepareThreshold=0". The problem is that this database picks up a lot of query like "SET application_name = 'PostgreSQL JDBC Driver' and "eating" connections pool. However, when I stop Metabase container everything looks fine.

Here's my configuration:
{ "browser-info": { "language": "pl", "platform": "Linux x86_64", "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0", "vendor": "" }, "system-info": { "file.encoding": "UTF-8", "java.runtime.name": "OpenJDK Runtime Environment", "java.runtime.version": "11.0.8+10", "java.vendor": "AdoptOpenJDK", "java.vendor.url": "https://adoptopenjdk.net/", "java.version": "11.0.8", "java.vm.name": "OpenJDK 64-Bit Server VM", "java.vm.version": "11.0.8+10", "os.name": "Linux", "os.version": "3.10.0-1160.el7.x86_64", "user.language": "en", "user.timezone": "Europe/Warsaw" }, "metabase-info": { "databases": [ "h2", "postgres" ], "hosting-env": "unknown", "application-database": "h2", "application-database-details": { "database": { "name": "H2", "version": "1.4.197 (2018-03-18)" }, "jdbc-driver": { "name": "H2 JDBC Driver", "version": "1.4.197 (2018-03-18)" } }, "run-mode": "prod", "version": { "date": "2020-08-17", "tag": "v0.36.4", "branch": "release-0.36.x", "hash": "196c1f6" }, "settings": { "report-timezone": null } } }

What can I do with it? I would appreciate any help :slight_smile:

Hi @Klaudzik
The name is defined via the JDBC driver, but you should be able to add this to the connection string:
ApplicationName=MyApp

Metabase should only "eat" up to 15 connections per database:
https://www.metabase.com/docs/latest/operations-guide/environment-variables.html#mb_jdbc_data_warehouse_max_connection_pool_size

You should migrate away from H2 if you're using Metabase in production:
https://www.metabase.com/docs/latest/operations-guide/running-metabase-on-docker.html#using-postgres-as-the-metabase-application-database

Latest release is 0.38.4:
https://github.com/metabase/metabase/releases/latest

Hi @flamber,

thanks for reply! I can't find option to set up maximum number of connections in GUI. Can I just add it in my docker-compose.yml file like one of env's?

EDIT: of course, I can :slight_smile: sorry :slight_smile: I will try it, thanks once again.