how to set postgresql command timeout in rails

后端 未结 4 725
梦谈多话
梦谈多话 2021-02-07 08:11

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?

4条回答
  •  醉话见心
    2021-02-07 08:52

    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
    

提交回复
热议问题