Re: Q: Executing functions at connect/disconnect?
От | Darko Prenosil |
---|---|
Тема | Re: Q: Executing functions at connect/disconnect? |
Дата | |
Msg-id | 000701c34191$8fef16a0$538abfd5@darko обсуждение исходный текст |
Ответ на | Q: Executing functions at connect/disconnect? ("Mattias Kregert" <mattias@kregert.se>) |
Список | pgsql-general |
----- Original Message ----- From: "Mattias Kregert" <mattias@kregert.se> To: "Darko Prenosil" <darko.prenosil@finteh.hr> Cc: <pgsql-general@postgresql.org> Sent: Friday, July 04, 2003 6:08 PM Subject: Re: [GENERAL] Q: Executing functions at connect/disconnect? Just as i thought... I have only one solution then; to have a cleanup function which is executed every now and then... Cleanup function: 1. Look in the Session table to find out which sessions are registered. 2. Determine if some of these sessions are "dead". 3. Update all those items/objects/rows held by the dead session(s) as "unused". 4. Unregister the session. I see two problems with this: A. How do I know if a session is dead or still connected? I need to get that information from the postmaster or my backend in some way, but I don't know how to do that. You can get backend PID using: SELECT pg_backend_pid(); and see all active connections using: SELECT * FROM pg_stat_activity; Hope that You are using 7.x version of PostgreSQL, I do not know exactly which version introduced statistic collector. Regards !
В списке pgsql-general по дате отправления: