From: | "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | "Pavel Stehule *EXTERN*" <pavel(dot)stehule(at)gmail(dot)com>, "Durumdara" <durumdara(at)gmail(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Unique Session ID in PGSQL? |
Date: | 2011-05-19 08:21:13 |
Message-ID: | D960CB61B694CF459DCFB4B0128514C20670CD06@exadv11.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Pavel Stehule wrote:
>> Is there any function in PGSQL that returns an unique Session
>> identifier of the actual session?
>> For example a Bigint, or GUID, or etc?
>> Can I get the living Session identifiers from PG?
>
> try
>
> postgres=# select pg_backend_pid();
> pg_backend_pid
> ----------------
> 17327
> (1 row)
I don't totally understand the intended use, but process IDs have the
problem that they will get reused eventually.
So if that's not good enough, you can construct a session ID like
%c in log_line_prefix with the query found in the documentation:
http://www.postgresql.org/docs/current/static/runtime-config-logging.html#GUC-LOG-LINE-PREFIX
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Hitoshi Harada | 2011-05-19 08:27:50 | Re: optimizing a cpu-heavy query |
Previous Message | Craig Ringer | 2011-05-19 08:14:20 | Re: question about readonly instances |