Links: (http://stackoverflow.com/questions/3508627/stop-long-running-sql-query-in-postgresql-when-session-or-requests-no-longer-e) (http://www.postgresql.org/docs/current/static/functions-admin.html#FUNCTIONS-ADMIN-SIGNAL-TABLE)
- Terminating backend:
--- To stop the query:
SELECT pg_cancel_backend(proced_id);
--- To kill the database connection: