We do not terminate any customer PostgreSQL queries even if they run "forever".
Long running queries can be identified in the running queries view in the web console and they can be terminated manually by calling the
SELECT pg_terminate_backend(pid) function over a database connection.
Running queries can also be monitored with a query like
SELECT * FROM pg_stat_activity WHERE state <> 'idle';
A client can use the
statement_timeout session variable to voluntarily request the server to automatically cancel any query over that connection that runs over a specified length of time, for example
SET statement_timeout = 15000 makes any query running over 15 seconds get cancelled automatically. See the PostgreSQL documentation for more information on the available session variables.