- Denish Patel
- 27th April 2020
- Database, postgres, postgresql
If you are using psql command line utility and wonder how you can set application_name…
If you try to set application_name using psql variable, it doesn’t work …
$ psql -d postgres -U elephas --variable=application_name=elephas_backupĀ postgres=# show application_name ; application_name ------------------ psql (1 row)
Option-1:
psql -U elephas -d 'dbname=postgres application_name=elephas_backup' postgres=# show application_name ; application_name ------------------ elephas_backup (1 row)
Option-2:
You can export PGAPPNAME variable before making a connection .. $export PGAPPNAME=myapp $ psql -d postgres Type "help" for help. postgres=# show application_name ; application_name ------------------ myapp (1 row)
Hopefully, it will help you to track down psql connections coming from various places.
Categories
Recent Blog
- Do you really need a DBA?
- Running VACUUM FULL in Non-blocking Mode
- Connection Scaling
- PSQL Helper: Managing Connections and Simplifying Queries
- Vacuum Those MVs!
- Working With Repmgr: Using Other 3rd Party Tools for Setting up a Standby
- Working with Amazon Aurora PostgreSQL: dag, standby rebooted again!
- Working with Amazon Aurora PostgreSQL: what happened to the stats?
- How to set application_name for psql command line utility?
- Is there a limit on number of partitions handled by Postgres?