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?
Best Answer
Limiting is hard, but you can set a timeout on query for a user :
As of the disk I'm not aware of any technique to limit disk usage of a query in postgresql.