Postgres Statement timeout has no effect on metabase queries

Due to some bad queries executed by users, my postgres db's CPU utilization increases 10 fold and it in turn affects every other users. Therefore, I set my db's statement timeout to 30s. When I execute any query that takes beyond 30s, it cancels it on jetbrains db client but metabase still keeps running it and that query doesn't timeout. How can I fix this?

Try changing this value to 30 sec