Re: Availability of pg_backend_pid() immediately after connection establishment

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: "Hari Bhaskaran" <hbhaskaran(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Availability of pg_backend_pid() immediately after connection establishment
Date: 2006-11-02 15:45:18
Message-ID: 16844.1162482318@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Magnus Hagander" <mha(at)sollentuna(dot)net> writes:
>> Someone in this group mentioned a while back that
>> pg_backend_pid() function works only after some 1/2 second
>> after the connection has been established.

> No, pg_backend_pid() returns MyProcPid, which is set on backend startup.

> However, the different pg_stat_* views won't work until a message has
> been passed down to the stats collector, that is correct.

That is to say, in existing releases there'll be a delay before a row
for your session is visible in pg_stat_activity. This problem will
go away in 8.2 though, because the mechanism for pg_stat_activity was
redone (the other pg_stat_* views still have a delay, but it's less
critical for them).

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message James Cradock 2006-11-02 15:47:53 Re: PostGIS
Previous Message Tomi NA 2006-11-02 15:44:20 Re: postgres import