zoukankan      html  css  js  c++  java
  • postgresql 的几个 timeout 参数

    今天整理了下 postgresql 几个 timeout 参数

    select version();
                                                     version                                                 
    ---------------------------------------------------------------------------------------------------------
     PostgreSQL 10.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18), 64-bit
    (1 row)
    
    
    
    select *
    from pg_settings ps
    where 1=1
    and ps.name like '%timeout%'
    ;
    
                    name                 | setting | unit |                           category                           |                                        short_desc                                         |             extra_desc              |  context  | vartype | source  | min_val |  max_val   | enumvals | boot_val | reset_val | sourcefile | sourceline | pending_restart 
    -------------------------------------+---------+------+--------------------------------------------------------------+-------------------------------------------------------------------------------------------+-------------------------------------+-----------+---------+---------+---------+------------+----------+----------+-----------+------------+------------+-----------------
     archive_timeout                     | 0       | s    | Write-Ahead Log / Archiving                                  | Forces a switch to the next WAL file if a new file has not been started within N seconds. |                                     | sighup    | integer | default | 0       | 1073741823 |          | 0        | 0         |            |            | f
     authentication_timeout              | 60      | s    | Connections and Authentication / Security and Authentication | Sets the maximum allowed time to complete client authentication.                          |                                     | sighup    | integer | default | 1       | 600        |          | 60       | 60        |            |            | f
     checkpoint_timeout                  | 300     | s    | Write-Ahead Log / Checkpoints                                | Sets the maximum time between automatic WAL checkpoints.                                  |                                     | sighup    | integer | default | 30      | 86400      |          | 300      | 300       |            |            | f
     deadlock_timeout                    | 1000    | ms   | Lock Management                                              | Sets the time to wait on a lock before checking for deadlock.                             |                                     | superuser | integer | default | 1       | 2147483647 |          | 1000     | 1000      |            |            | f 
     idle_in_transaction_session_timeout | 0       | ms   | Client Connection Defaults / Statement Behavior              | Sets the maximum allowed duration of any idling transaction.                              | A value of 0 turns off the timeout. | user      | integer | default | 0       | 2147483647 |          | 0        | 0         |            |            | f
     lock_timeout                        | 0       | ms   | Client Connection Defaults / Statement Behavior              | Sets the maximum allowed duration of any wait for a lock.                                 | A value of 0 turns off the timeout. | user      | integer | default | 0       | 2147483647 |          | 0        | 0         |            |            | f
     statement_timeout                   | 0       | ms   | Client Connection Defaults / Statement Behavior              | Sets the maximum allowed duration of any statement.                                       | A value of 0 turns off the timeout. | user      | integer | default | 0       | 2147483647 |          | 0        | 0         |            |            | f
     wal_receiver_timeout                | 60000   | ms   | Replication / Standby Servers                                | Sets the maximum wait time to receive data from the primary.                              |                                     | sighup    | integer | default | 0       | 2147483647 |          | 60000    | 60000     |            |            | f
     wal_sender_timeout                  | 60000   | ms   | Replication / Sending Servers                                | Sets the maximum time to wait for WAL replication.                                        |                                     | sighup    | integer | default | 0       | 2147483647 |          | 60000    | 60000     |            |            | f
    (9 rows)

    下面简单介绍下这几个参数
    archive_timeout
    控制服务器周期性地切换到一个新的 WAL 段文件,通俗的讲,就是定时归档。

    authentication_timeout
    完成服务器认证的最长时间,如果在这个时间内没有完成认证,服务器将关闭连接。

    checkpoint_timeout
    自动 WAL 检查点之间的最长时间,增大这个参数会使数据库崩溃后恢复的时间加长。

    deadlock_timeout
    进行死锁检测之前在一个锁上等待的总时间

    idle_in_transaction_session_timeout
    空闲事务超时。终止任何已经闲置超过这个参数所指定的时间(以毫秒计)的打开事务的会话。 这使得该会话所持有的任何锁被释放,并且其所持有的连接槽可以被重用, 它也允许只对这个事务可见的元组被清理。

    lock_timeout
    锁等待超时。语句在试图获取表、索引、行或其他数据库对象上的锁时等到超过指定的毫秒数,该语句将被中止。不推荐在postgresql.conf中设置。

    statement_timeout
    控制语句执行时长,单位是ms。超过设定值,该语句将被中止。
    不推荐在postgresql.conf中设置,如非要设置,应该设置一个较大值。

    wal_receiver_timeout
    中止处于非活动状态超过指定毫秒数的复制链接。这对于正在接收的后备服务器检测主服务器崩溃或网络断开有用。设置为0会禁用超时机制。这个参数只能在postgresql.conf文件中或在服务器命令行上设置。默认值是 60 秒。

    wal_sender_timeout
    中断那些停止活动超过指定毫秒数的复制连接。这对发送服务器检测一个后备机崩溃或网络中断有用。设置为0将禁用该超时机制。这个参数只能在postgresql.conf文件中或在服务器命令行上设置。默认值是 60 秒。

  • 相关阅读:
    【JavaScript】explode动画
    【JavaScript】插件参数的写法
    【webpack】理解配置文件
    你真的了解盒模型么
    一看看懂Protocol Buffer(协议篇)
    es7你都懂了吗?今天带你了解es7的神器decorator
    快速了解react
    简单聊一聊那些svg的沿路径运动
    转转RN工程化历程
    微信小程序内嵌网页的一些(最佳)实践
  • 原文地址:https://www.cnblogs.com/ctypyb2002/p/9793043.html
Copyright © 2011-2022 走看看