Re: Really unique session ID - PID + connection timestamp?

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Durumdara <durumdara(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Really unique session ID - PID + connection timestamp?
Date: 2016-04-09 11:42:25
Message-ID: 20160409114225.GR10850@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings,

* Durumdara (durumdara(at)gmail(dot)com) wrote:
> Where I can get timestamp or some other unique data with I can create a
> combined primary key?

Not entirely sure about the rest of it, but if you want backend start
time, you can look at pg_stat_activity (which also happens to have the
pid).

If you want just your own, combine it with pg_backend_pid, as in:

select
pid || ',' || backend_start
from pg_stat_activity where pid = pg_backend_pid();

Thanks!

Stephen

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Durumdara 2016-04-09 11:48:57 Re: Really unique session ID - PID + connection timestamp?
Previous Message Bannert Matthias 2016-04-09 10:50:41 Re: max_stack_depth problem though query is substantially smaller