I had some problems last month. I had a bad query in Postgres (PostGIS) of a user launched during the night. This query took all the memory and I had 0% of free disk.
Fortunately, I restored the database with my dumps, it's ok, but I'm afraid for the next time.
Can I predict a bad query in Postgres and stop it immediately?
Which tools? Which scripts? Do you recommend any?