>>>>> "Tsunakawa" == Tsunakawa, Takayuki <tsunakawa.ta...@jp.fujitsu.com> 
>>>>> writes:

 >> From the temp table namespace I can get the backend ID using a regex
 >> - but I have no idea how I can map that to a PID - any thoughts?

 Tsunakawa> SELECT pg_stat_get_backend_pid(backendid);

Doesn't work - that function's idea of "backend id" doesn't match the
real one, since it's looking at a local copy of the stats from which
unused slots have been removed.

postgres=# select pg_my_temp_schema()::regnamespace;
 pg_my_temp_schema 
-------------------
 pg_temp_5
(1 row)

postgres=# select pg_stat_get_backend_pid(5);
 pg_stat_get_backend_pid 
-------------------------
                    4730
(1 row)

postgres=# select pg_backend_pid();
 pg_backend_pid 
----------------
          21086
(1 row)

-- 
Andrew (irc:RhodiumToad)

Reply via email to