From: | "Magnus Hagander" <mha(at)sollentuna(dot)net> |
---|---|
To: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Function to kill backend |
Date: | 2004-04-02 21:52:16 |
Message-ID: | 6BCB9D8A16AC4241919521715F4D8BCE171637@algol.sollentuna.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi!
When debugging on win32, I've created myself a little function that I
feel should be added to the "backend proper". While it adds a lot of
vlaue on win32, I think it adds quite a bit of value on non-win32
platforms as well...
The function is pg_kill_backend(<pid>,<signal>). superuser-only, of
course. Which simply sends a signal to the specified backend -
querycancel, terminate, etc.
The advantage over using the kill command from a shell account is, well,
you don't need shell access to the db server. On win32, that's going to
be more common than on Unix - plus, if you want to signal a specific
backend, you need a special tool (can't do from tas kmanager/service
manager etc - service manager can only do the postmaster, and task
manager can only do kill -9).
I also think a function like this could be good to have for e.g.
pgadmin, to implement some more "management functionality". For example,
in MSSQL I can go into a view called "current activity", pick a "bad
user", right-click and cancel query or terminate session. To do this
remote, a funciton like this is required. pg_stat_activity can be used
to get a list of sessions and their pids. The function should probably
be complemented with a pg_get_postmasterpid or something along that way,
to be able to send signals to th epostmaster itself.
So, would such a function be accepted into the backend code? And if so,
any preferences on where you want it put?
//Magnus
From | Date | Subject | |
---|---|---|---|
Next Message | Manfred Koizar | 2004-04-02 21:53:29 | Re: [GENERAL] Large DB |
Previous Message | Alvaro Herrera | 2004-04-02 20:35:03 | Re: Problems Vacuum'ing |