Re: session_id

From: Richard Huxton <dev(at)archonet(dot)com>
To: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
Cc: abief_ag_-postgresql(at)yahoo(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: session_id
Date: 2004-11-17 14:44:51
Message-ID: 419B63E3.5040900@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Achilleus Mantzios wrote:
> O Richard Huxton έγραψε στις Nov 17, 2004 :
>
>
>>Riccardo G. Facchini wrote:
>>
>>>hi all,
>>>
>>>is there a way to determine the session id on a database session?
>>>
>>>I would need to have a unique number whenever a session is started, and
>>>have this available as a function or view result.
>
>
> Why not SELECT pg_backend_pid();
> ??

This is guaranteed to be unique while connected, but if you want to
track sessions over time isn't guaranteed to be. So, if you might have
pid=1234 now and also a month ago in a different session (especially if
you had a server reboot in-between).

Of course, if Riccardo doesn't need that, the pid is fine.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2004-11-17 14:52:54 Re: Counting Distinct Records
Previous Message Achilleus Mantzios 2004-11-17 14:33:03 Re: session_id