国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術及軟件下載分享
分類導航

Mysql|Sql Server|Oracle|Redis|MongoDB|PostgreSQL|Sqlite|DB2|mariadb|Access|數據庫技術|

服務器之家 - 數據庫 - PostgreSQL - postgresql 中的幾個 timeout參數 用法說明

postgresql 中的幾個 timeout參數 用法說明

2021-03-27 21:01peiybpeiyb PostgreSQL

這篇文章主要介紹了postgresql中的幾個timeout參數用法說明,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

今天整理了下 postgresql 幾個 timeout 參數

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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 秒。

補充:Postgresql數據庫修改deadlock_timeout參數

某產品線提出要將Postgresql測試庫中 deadlock_timeout 參數 修改為1s

該庫平時不在自己手中維護,故實際操作步驟如下

(1)確定數據庫安裝所屬用戶

查看下都有哪些賬戶,可能是postgresql使用的

?
1
2
3
bash-4.1$ cd /home
bash-4.1$ ls
aquota.user enterprisedb lost+found prouser puppet

(2)確定數據庫安裝路徑:

bash-4.1$ ps -ef | grep post 查看服務進程,找到應用安裝目錄 /opt/app/PostgresPlus/9.2AS/

?
1
500 1891 1 0 2018 ? 01:01:47 /opt/app/PostgresPlus/9.2AS/bin/edb-postgres -D /DATA/data_utl

(3)切換到 enterprisedb 用戶,并登陸數據庫

?
1
2
3
4
bash-4.1$ su - enterprisedb
bash-4.1$ psql -U enterprisedb
psql (9.2.14.31)
Type “help” for help.

查看當前該參數配置 3s

?
1
edb=# show deadlock_timeout;

deadlock_timeout

 

?
1
2
3s
(1 row)

(4)查看該參數

postgresql 中的幾個 timeout參數 用法說明

?
1
pending_restart —boolean— true if the value has been changed in the configuration file but needs a restart; or false otherwise.

即該參數為實時生效型參數

(5)嘗試使用

?
1
test=# alter system set deadlock_timeout=‘1s';

報錯如下:

?
1
2
ERROR: syntax error at or near “system”
LINE 1: alter system set deadlock_timeout=‘1s';

查詢到解釋:

alter system 命令 只對 9.4以后的版本 的版本有效,

(6)嘗試執行

?
1
2
set deadlock_timeout=‘1s'
edb=# show deadlock_timeout;

顯示為1s

但是其余用戶登錄路,發現該參數依然為 3s

----即該方法為session級別設置,類似于oracle的alter session set

(7) 嘗試修改 pg配置文件,進入/DATA/data_utl 路徑修改

?
1
2
3
4
5
6
7
bash-4.1$ pwd
/DATA/data_utl
bash-4.1$ ls
base pgbin pg_ident.conf pg_notify pg_stat_tmp pg_twophase postgresql.conf postmaster.opts
dbms_pipe pg_clog pg_log pg_serial pg_subtrans PG_VERSION postgresql.conf.20191119 postmaster.pid
global pg_hba.conf pg_multixact pg_snapshots pg_tblspc pg_xlog postgresql.conf.bak utlp.sql
vi postgresql.conf

將其中 deadlock_timeout 配置修改為1s

(8)重新加載數據庫

?
1
2
bash-4.1$ ./pg_ctl reload
server signaled

(9)查看該參數已生效

?
1
2
3
4
edb=# show deadlock_timeout;
deadlock_timeout
1s
(1 row)

退出

?
1
edb=# \q

第9步也可通過重啟數據庫生效

停止指令:

?
1
./pg_ctl stop -m fast

啟動指令:

?
1
./pg_ctl -D /DATA/data_utl start

以上為個人經驗,希望能給大家一個參考,也希望大家多多支持服務器之家。如有錯誤或未考慮完全的地方,望不吝賜教。

原文鏈接:https://www.cnblogs.com/ctypyb2002/p/9793043.html

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 色综合色综合网色综合 | 亚洲精品1| 日韩a∨ | 亚洲一区二区国产 | 亚洲欧美日韩国产综合精品二区 | 精品久久一二三区 | 这里只有精品在线视频观看 | 日韩av一级在线观看 | 91精品国产91久久综合桃花 | 国产精品网站在线观看 | 久久亚洲综合 | 国产精品成人一区二区三区 | 成人免费网站在线观看 | 亚洲二区在线 | 久久久美女 | 亚洲专区中文字幕 | 天堂99x99es久久精品免费 | 久久久精品精品 | 国产高清精品在线 | 欧美精品在线一区 | 亚洲国产精品成人 | 四虎影院在线免费播放 | 成人国产精品免费观看 | 成人午夜精品久久久久久久蜜臀 | 欧美日韩中文字幕 | 99爱在线观看| 中文字幕亚洲一区二区三区 | 久久久久久网址 | 日韩精品视频一区二区三区 | 欧美一区二区三区在线观看视频 | 国产一区二区三区午夜 | 久青草视频 | 亚洲综合在线播放 | 国产精品视频免费看 | 午夜精品视频 | 黄色小网站在线观看 | 久久久久一区二区三区 | 日韩午夜| 二区在线视频 | 黄色片网站在线看 | 91精品国产综合久久久久 |