Application Name in PostgreSQL

Application Name in PostgreSQL

March 31, 2023

From Dimitri’s The Art of PostgreSQL. PostgreSQL has an application_name parameter, which you can set in the connection string. It is then possible have it reported in the server’s logs and is also part of the system pg_stat_activity.

For example:

"postgres://user:pass@127.0.0.1:5432/db_name?application_name=app_name"