<br>Hi,<br><br>I am seeing some waiting postgres processes when users create large select queries via the web browser.<br>Often their browser times out, or they leave the page, but the query persists.<br><br>When I do a pg_top and then Q to show what the query is doing it shows me the select is still happening.<br>
<br>I have tried cancelling this select with<br><br>SELECT pg_cancel_backend(8354) FROM pg_stat_activity;<br><br>where 8354 was the PID of the select process<br><br>but it persisted.<br><br>so then I did<br><br>SELECT pg_terminate_backend(8354) FROM pg_stat_activity;<br>
<br>but this crashed the whole db and I had to restart it.<br><br>Is there a better way to cancel such queries?<br><br>Thanks,<br><br>Oliver<br><br><br>