session id and global storage

Started by David Hokszaover 19 years ago5 messages
#1David Hoksza
david.hoksza@seznam.cz

Hi, I cant find any function, which tells me something like session
id. Is there something like that? I need it in my AM, because I need
to know, if something which I wrote in file was written in this
current session or previously.

And second thing - it would be great if I could save pointer in some
global storage, because I would like to access my dynamically created
tree in more subsequent scans, which is impossible with void pointer
stored just in opaque scan structure:(

Thnaks,
David Hoksza

#2David Hoksza
david.hoksza@seznam.cz
In reply to: David Hoksza (#1)
Re: session id and global storage

Something like this would be maybe possible, but this select can
return more rows, when the user is connected with more instances...

David Hoksza

________________________________

Hi, I cant find any function, which tells me something like session
id. Is there something like that? I need it in my AM, because I need
to know, if something which I wrote in file was written in this
current session or previously.

AL> How about

AL> select procpid||' '||backend_start from pg_stat_activity;

AL> Yours,
AL> Laurenz Albe

#3David Hoksza
david.hoksza@seznam.cz
In reply to: David Hoksza (#2)
Re: session id and global storage

It seems MyProcID is what I was searching for...

David Hoksza
________________________________

DH> Something like this would be maybe possible, but this select can
DH> return more rows, when the user is connected with more instances...

DH> David Hoksza

DH> ________________________________

Hi, I cant find any function, which tells me something like session
id. Is there something like that? I need it in my AM, because I need
to know, if something which I wrote in file was written in this
current session or previously.

AL>> How about

AL>> select procpid||' '||backend_start from pg_stat_activity;

AL>> Yours,
AL>> Laurenz Albe

DH> ---------------------------(end of
DH> broadcast)---------------------------
DH> TIP 5: don't forget to increase your free space map settings

#4Hannu Krosing
hannu@skype.net
In reply to: David Hoksza (#3)
Re: session id and global storage

Ühel kenal päeval, N, 2006-06-01 kell 10:10, kirjutas David Hoksza:

It seems MyProcID is what I was searching for...

On a buzy server with lots of connects, procID will repeat quite often.

--
----------------
Hannu Krosing
Database Architect
Skype Technologies OÜ
Akadeemia tee 21 F, Tallinn, 12618, Estonia

Skype me: callto:hkrosing
Get Skype for free: http://www.skype.com

#5Andrew Dunstan
andrew@dunslane.net
In reply to: Hannu Krosing (#4)
Re: session id and global storage

Hannu Krosing said:

Ühel kenal päeval, N, 2006-06-01 kell 10:10, kirjutas David Hoksza:

It seems MyProcID is what I was searching for...

On a buzy server with lots of connects, procID will repeat quite often.

log_line-prefix has a sessionid gadget:

Session ID: A unique identifier for each session. It is 2 4-byte hexadecimal
numbers (without leading zeros) separated by a dot. The numbers are the
session start time and the process ID

Assuming PIDs are not reused within one second that will be unique.

cheers

andrew