SELECT * FROM pg_stat_activity WHERE state = 'active';
So you can identify the PID of the hanging query you want to terminate, run this:
SELECT pg_cancel_backend(PID);
Dataclips allow the results of SQL queries on a Heroku Postgres database to be easily shared. Simply create a query on dataclips.heroku.com, and then share the resulting URL with co-workers, colleagues, or the world. The recipients of a dataclip are able to view the data in their browser or download it in JSON, CSV, XML, or Microsoft Excel formats
Tuning your PostgreSQL database is somewhat of a black art. While documentation does exist on the topic, many people still find it hard to get all the power out of their system. This article aims to help demystify PostgreSQL database performance tuning.