如何在rails中设置postgresql命令超时 [英] how to set postgresql command timeout in rails
本文介绍了如何在rails中设置postgresql命令超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用heroku和heroku PostgreSQL.如何设置db命令超时,以便在sql命令花费超过10秒的时间时出现异常?
I'm using heroku and heroku postgresql. How do I set db command timeout so that I get an exception when a sql command takes longer than 10 seconds?
推荐答案
像这样配置您的database.yml,关键是变量哈希:
Configure your database.yml like this, the key bit being the variables hash:
defaults: &default
adapter: postgresql
encoding: unicode
pool: 5
min_messages: warning
variables:
statement_timeout: 5000
这篇关于如何在rails中设置postgresql命令超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文