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

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Christoph Berg <cb(at)df7cb(dot)de>, Durumdara <durumdara(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Really unique session ID - PID + connection timestamp?
Date: 2016-04-09 11:57:12
Message-ID: 20160409115712.GT10850@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

* Christoph Berg (cb(at)df7cb(dot)de) wrote:
> Re: Durumdara 2016-04-09 <CAEcMXhkyUMmT3wiKnyWwSK1Xv3gFot46AoTM+6JxWhya3dGWjg(at)mail(dot)gmail(dot)com>
> > In MS the session id is smallint, so it can repeats after server restarts,
> > but my coll. found a "session creation timestamp".
> > This is a key which unique.
> > With this we can check for died sessions and we can clean their records.
> >
> > We want create same mechanism.
> > I know there are adv. locks in PG, but I want to use session id.
> >
> > This could be:
> > pg_backend_pid()
> >
> > May pid repeats.
> > Where I can get timestamp or some other unique data with I can create a
> > combined primary key?
>
> Btw, what you are describing is exactly what %c in log_line_prefix
> does.

That's not currently exposed at an SQL level anywhere though, is it?
Perhaps we should add a way to get that. Another thought would be to
essentially expose 'log_line_prefix()' at the SQL level but I'm not sure
that generally makes sense. We could also have an explicit function to
get MyStartTime, similar to pg_backend_pid().

Thanks!

Stephen

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christoph Berg 2016-04-09 12:40:03 Re: Really unique session ID - PID + connection timestamp?
Previous Message Durumdara 2016-04-09 11:48:57 Re: Really unique session ID - PID + connection timestamp?