Wei Weng <wweng@kencast.com> writes:
> I have a side question. How do I stop this kind of crazy query to suck up
> my CPU power if it is fed by a database driver? (like ODBC, for example)
> Since kill -9 postmaster is highly not recommended, can i do a
> /sbin/service postgresql stop to force it to shut down?
That would shut down the whole database, which is likely not what you
want. The best way to cancel a runaway query is to cancel it, ie,
send a cancel request from the client (cf. control-C in psql, dunno
whether the ODBC driver supports this). If you are logged into the
postgres or root account on the DB machine, you can get the same
effect with "kill -INT pid-of-backend". (not pid-of-postmaster)
regards, tom lane