Is there a timeout for idle PostgreSQL connections?

前端 未结 5 1383
暗喜
暗喜 2020-11-27 10:07
1 S postgres  5038   876  0  80   0 - 11962 sk_wai 09:57 ?        00:00:00 postgres: postgres my_app ::1(45035) idle                                                          


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 10:17

    In PostgreSQL 9.6, there's a new option idle_in_transaction_session_timeout which should accomplish what you describe. You can set it using the SET command, e.g.:

    SET SESSION idle_in_transaction_session_timeout = '5min';
    

提交回复
热议问题