Realist
Realist

Reputation: 509

Is there a parameter I can provide to a Postgres connection string to "name" a client?

We have a postgres database which a lot of scripts connect to. Crucially, there is not a username per-script; there are a (small) number of usernames which are shared around the place.

When doing troubleshooting or performance optimising, it would be very useful to know which server SQL process corresponds (or corresponded, past-tense) to which script.

I am thinking of something like:

host=db-server dbname=whatever clientID=script1.py

I suspect the answer is "no", but my google-fu is weak.

Upvotes: 3

Views: 97

Answers (1)

chotchki
chotchki

Reputation: 4343

You can explore using the "application_name" parameter. Depending on what your code is doing you can log it.

Upvotes: 4

Related Questions