Aiven does not terminate any customer PostgreSQL queries even if they run "forever".

Long running queries often cause problems by locking resources and preventing database maintenance tasks from proceeding.

Long running queries can be identified in the running queries view in the web console, which also allows direct termination of them. 


You could also manually terminate the queries 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.

Did this answer your question?