欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

postgresql 中的幾個(gè) timeout參數(shù) 用法說(shuō)明

 更新時(shí)間:2021年01月16日 15:28:12   作者:peiybpeiyb  
這篇文章主要介紹了postgresql中的幾個(gè)timeout參數(shù)用法說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧

今天整理了下 postgresql 幾個(gè) timeout 參數(shù)

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)

下面簡(jiǎn)單介紹下這幾個(gè)參數(shù)

archive_timeout

控制服務(wù)器周期性地切換到一個(gè)新的 WAL 段文件,通俗的講,就是定時(shí)歸檔。

authentication_timeout

完成服務(wù)器認(rèn)證的最長(zhǎng)時(shí)間,如果在這個(gè)時(shí)間內(nèi)沒(méi)有完成認(rèn)證,服務(wù)器將關(guān)閉連接。

checkpoint_timeout

自動(dòng) WAL 檢查點(diǎn)之間的最長(zhǎng)時(shí)間,增大這個(gè)參數(shù)會(huì)使數(shù)據(jù)庫(kù)崩潰后恢復(fù)的時(shí)間加長(zhǎng)。

deadlock_timeout

進(jìn)行死鎖檢測(cè)之前在一個(gè)鎖上等待的總時(shí)間

idle_in_transaction_session_timeout

空閑事務(wù)超時(shí)。終止任何已經(jīng)閑置超過(guò)這個(gè)參數(shù)所指定的時(shí)間(以毫秒計(jì))的打開(kāi)事務(wù)的會(huì)話。 這使得該會(huì)話所持有的任何鎖被釋放,并且其所持有的連接槽可以被重用, 它也允許只對(duì)這個(gè)事務(wù)可見(jiàn)的元組被清理。

lock_timeout

鎖等待超時(shí)。語(yǔ)句在試圖獲取表、索引、行或其他數(shù)據(jù)庫(kù)對(duì)象上的鎖時(shí)等到超過(guò)指定的毫秒數(shù),該語(yǔ)句將被中止。不推薦在postgresql.conf中設(shè)置。

statement_timeout

控制語(yǔ)句執(zhí)行時(shí)長(zhǎng),單位是ms。超過(guò)設(shè)定值,該語(yǔ)句將被中止。

不推薦在postgresql.conf中設(shè)置,如非要設(shè)置,應(yīng)該設(shè)置一個(gè)較大值。

wal_receiver_timeout

中止處于非活動(dòng)狀態(tài)超過(guò)指定毫秒數(shù)的復(fù)制鏈接。這對(duì)于正在接收的后備服務(wù)器檢測(cè)主服務(wù)器崩潰或網(wǎng)絡(luò)斷開(kāi)有用。設(shè)置為0會(huì)禁用超時(shí)機(jī)制。這個(gè)參數(shù)只能在postgresql.conf文件中或在服務(wù)器命令行上設(shè)置。默認(rèn)值是 60 秒。

wal_sender_timeout

中斷那些停止活動(dòng)超過(guò)指定毫秒數(shù)的復(fù)制連接。這對(duì)發(fā)送服務(wù)器檢測(cè)一個(gè)后備機(jī)崩潰或網(wǎng)絡(luò)中斷有用。設(shè)置為0將禁用該超時(shí)機(jī)制。這個(gè)參數(shù)只能在postgresql.conf文件中或在服務(wù)器命令行上設(shè)置。默認(rèn)值是 60 秒。

補(bǔ)充:Postgresql數(shù)據(jù)庫(kù)修改deadlock_timeout參數(shù)

某產(chǎn)品線提出要將Postgresql測(cè)試庫(kù)中 deadlock_timeout 參數(shù) 修改為1s

該庫(kù)平時(shí)不在自己手中維護(hù),故實(shí)際操作步驟如下

(1)確定數(shù)據(jù)庫(kù)安裝所屬用戶

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

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

(2)確定數(shù)據(jù)庫(kù)安裝路徑:

bash-4.1$ ps -ef | grep post 查看服務(wù)進(jìn)程,找到應(yīng)用安裝目錄 /opt/app/PostgresPlus/9.2AS/

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

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

bash-4.1$ su - enterprisedb
bash-4.1$ psql -U enterprisedb
psql (9.2.14.31)
Type “help” for help.

查看當(dāng)前該參數(shù)配置 3s

edb=# show deadlock_timeout;

deadlock_timeout

3s
(1 row)

(4)查看該參數(shù)

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

即該參數(shù)為實(shí)時(shí)生效型參數(shù)

(5)嘗試使用

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

報(bào)錯(cuò)如下:

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

查詢到解釋:

alter system 命令 只對(duì) 9.4以后的版本 的版本有效,

(6)嘗試執(zhí)行

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

顯示為1s

但是其余用戶登錄路,發(fā)現(xiàn)該參數(shù)依然為 3s

----即該方法為session級(jí)別設(shè)置,類似于oracle的alter session set

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

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)重新加載數(shù)據(jù)庫(kù)

bash-4.1$ ./pg_ctl reload
server signaled

(9)查看該參數(shù)已生效

edb=# show deadlock_timeout;
deadlock_timeout
1s
(1 row)

退出

edb=# \q

第9步也可通過(guò)重啟數(shù)據(jù)庫(kù)生效

停止指令:

./pg_ctl stop -m fast

啟動(dòng)指令:

./pg_ctl -D /DATA/data_utl start

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教。

相關(guān)文章

  • PostgreSQL數(shù)據(jù)庫(kù)遷移部署實(shí)戰(zhàn)教程

    PostgreSQL數(shù)據(jù)庫(kù)遷移部署實(shí)戰(zhàn)教程

    這篇文章主要介紹了PostgreSQL數(shù)據(jù)庫(kù)遷移部署實(shí)戰(zhàn)教程,由于項(xiàng)目本身就是基于PostgreSQL數(shù)據(jù)庫(kù)構(gòu)建的,因此數(shù)據(jù)庫(kù)遷移將變得十分便捷,接下來(lái),我將簡(jiǎn)要介紹我們的遷移步驟,需要的朋友可以參考下
    2023-07-07
  • 淺談postgresql數(shù)據(jù)庫(kù)varchar、char、text的比較

    淺談postgresql數(shù)據(jù)庫(kù)varchar、char、text的比較

    這篇文章主要介紹了淺談postgresql數(shù)據(jù)庫(kù)varchar、char、text的比較,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-12-12
  • postgresql 實(shí)現(xiàn)取出分組中最大的幾條數(shù)據(jù)

    postgresql 實(shí)現(xiàn)取出分組中最大的幾條數(shù)據(jù)

    這篇文章主要介紹了postgresql 實(shí)現(xiàn)取出分組中最大的幾條數(shù)據(jù),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2021-01-01
  • Postgresql數(shù)據(jù)庫(kù)中的json類型字段使用示例詳解

    Postgresql數(shù)據(jù)庫(kù)中的json類型字段使用示例詳解

    JSON的主要用于在服務(wù)器與web應(yīng)用之間傳輸數(shù)據(jù),這篇文章主要介紹了Postgresql數(shù)據(jù)庫(kù)中的json類型字段使用,本文結(jié)合實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-02-02
  • PostgreSQL 實(shí)現(xiàn)給查詢列表增加序號(hào)操作

    PostgreSQL 實(shí)現(xiàn)給查詢列表增加序號(hào)操作

    這篇文章主要介紹了PostgreSQL 實(shí)現(xiàn)給查詢列表增加序號(hào)操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2021-01-01
  • Postgresql 如何選擇正確的關(guān)閉模式

    Postgresql 如何選擇正確的關(guān)閉模式

    這篇文章主要介紹了Postgresl 如何選擇正確的關(guān)閉模式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2021-01-01
  • Postgresql之時(shí)間戳long,TimeStamp,Date,String互轉(zhuǎn)方式

    Postgresql之時(shí)間戳long,TimeStamp,Date,String互轉(zhuǎn)方式

    這篇文章主要介紹了Postgresql中的時(shí)間戳long,TimeStamp,Date,String互轉(zhuǎn)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-03-03
  • PostgreSQL 慢查詢SQL跟蹤操作

    PostgreSQL 慢查詢SQL跟蹤操作

    這篇文章主要介紹了PostgreSQL 慢查詢SQL跟蹤操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2021-01-01
  • postgresql中時(shí)間轉(zhuǎn)換和加減操作

    postgresql中時(shí)間轉(zhuǎn)換和加減操作

    這篇文章主要介紹了postgresql中時(shí)間轉(zhuǎn)換和加減操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-12-12
  • PostgreSQL進(jìn)行重置密碼的方法小結(jié)

    PostgreSQL進(jìn)行重置密碼的方法小結(jié)

    今天想測(cè)試一個(gè)PostgresSQL語(yǔ)法的 SQL,但是打開(kāi)PostgresSQL之后沉默了,密碼是什么?日長(zhǎng)月久的,漸漸就忘記了,于是開(kāi)始了尋找密碼的道路,所以本文介紹了Postgresql忘記密碼,如何重置密碼,需要的朋友可以參考下
    2024-05-05

最新評(píng)論