postgresql custom variable in pg_settings table

2024-01-08 Thread Yi Sun
Hello, We custom set variable Added patroni.nodes_count = 2 in postgresql.conf postgres=# show patroni.nodes_count; patroni.nodes_count - 2 (1 row) postgres=# select current_setting('patroni.nodes_count'); current_setting - 2 (1 row) But can not select

How to grant read only functions execute permission to read only user

2023-07-17 Thread Yi Sun
Hello guys, Our read only user is okay to be granted read only permission of tables. How to grant read only functions execute permission to read only user, is there a simple way to do it please? If not, how to get the list of read only functions please? Then can grant one by one based on the

pg_wal directory max size

2022-12-21 Thread Yi Sun
Hello guys, We are planning the server disk space, pg_wal directory max size is wal file size*wal_keep_segments? or is it also decided by other parameters please? We tried to search for this, but could not find the answer For example our postgresql is 9.6 below parameters value, is the pg_wal

Re: How to know how much CPU, RAM is used by existing 1 database

2022-10-26 Thread Yi Sun
On Wed, 26 Oct 2022 at 18:10, jian he wrote: > > > On Wed, Oct 26, 2022 at 11:07 AM Yi Sun wrote: > >> Hi Guys, >> >> Who can help me with this please? I researched but still no result yet, >> thank you >> >> On Tue, 25 Oct 2022 at 16:30,

Re: How to know how much CPU, RAM is used by existing 1 database

2022-10-25 Thread Yi Sun
Hi Guys, Who can help me with this please? I researched but still no result yet, thank you On Tue, 25 Oct 2022 at 16:30, Yi Sun wrote: > Hi, > > There are many databases in our production patroni cluster and it seems it > is overloaded, so we decide to migrate the busiest datab

How to know how much CPU, RAM is used by existing 1 database

2022-10-25 Thread Yi Sun
Hi, There are many databases in our production patroni cluster and it seems it is overloaded, so we decide to migrate the busiest database to a new patroni cluster. pgwatch2 is implemented, how to know how much CPU, RAM is used by the database please? Then we can use it to prepare the new

How to check if checkpoint is finished in sql script?

2022-09-05 Thread Yi Sun
Hello all, We want to restart postgresql 3 nodes(2 replica nodes) by ansible as below steps: 1. Restart 2 replica nodes one by one 2. Run checkpoint in the leader node 3. Once checkpoint finished, restart the leader node How to check if the checkpoint is finished in sql script please? We know

VACUUM FULL missing chunk number 0 for toast value

2022-01-03 Thread Yi Sun
Hi All, OS: CentOS 7.6 PG: 11.11 Once we tried to vacuum full a table, got the error msg "ERROR: missing chunk number 0 for toast value", there is a doc as below for the select issue, but for our case select is no issue, what's the reason caused and how to fix this please? Thanks

Re: ssl_crl_file Certificate Revocation List doesn't work for postgresql 11

2021-12-02 Thread Yi Sun
Hi Kyotaro, Thank you for your explanation, after putting the crl file to client, it works now, thanks. Kyotaro Horiguchi 于2021年12月2日周四 下午12:46写道: > Hi. > > At Thu, 2 Dec 2021 11:31:26 +0800, Yi Sun wrote in > > Hi Kyotaro > > > > From the description, seems ~/.po

Re: ssl_crl_file Certificate Revocation List doesn't work for postgresql 11

2021-12-01 Thread Yi Sun
Hi Kyotaro >From the description, seems ~/.postgresql/root.crl is store client revoked certificate https://www.postgresql.org/docs/11/libpq-ssl.html ~/.postgresql/root.crl certificates revoked by certificate authorities server certificate must not be on this list Just don't know why server

Re: ssl_crl_file Certificate Revocation List doesn't work for postgresql 11

2021-12-01 Thread Yi Sun
:06 +0800, Yi Sun wrote in > > # cat /home/sunyi/tls/root.crt /home/sunyi/tls/1/root.crl > > /tmp/test_1.pem > > # openssl verify -extended_crl -verbose -CAfile /tmp/test_1.pem > -crl_check > > /home/sunyi/tls/1/server.crt > > I guess what you really

Re: ssl_crl_file Certificate Revocation List doesn't work for postgresql 11

2021-11-30 Thread Yi Sun
" Password: SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off) Is there any more configuration need to do please? Thanks Thanks and best regards Sun Yi Gabriel Cabillon 于2021年11月30日周二 下午10:03写道: > El 30/11/2021 a las 10:53, Yi Sun escri

ssl_crl_file Certificate Revocation List doesn't work for postgresql 11

2021-11-30 Thread Yi Sun
Hi All, OS: CentOS 7.6 PG: 11.11 Our env already configured ssl --server postgresql.conf ssl = 'on' ssl_ca_file = '/var/lib/pgsql/tls/root.crt' ssl_cert_file = '/var/lib/pgsql/tls/server.crt' ssl_key_file = '/var/lib/pgsql/tls/server.key' --client configuration $ ls -alrt

plpython3 package installation problem

2021-10-25 Thread Yi Sun
Hello, As we need to use the plpython3u extension, we tried to install the plpython3 package but showed that we needed to install python3-libs, but python36-libs was already installed for patroni usage. 1. Will installing python3-libs affect current python36-libs usage? 2. If we can do some

Re: pg_upgrade problem as locale difference in data centers

2021-09-26 Thread Yi Sun
Hi Tom, Thank you for your help. As we use ansible to deploy the upgrade, so mentioned the data centers situation. The PostgreSQL is single node and the upgrade will be in the same data center and same Linux server(Centos 7), just will run the ansible to upgrade PG in all Data centers. For

Re: pg_upgrade problem as locale difference in data centers

2021-09-20 Thread Yi Sun
As we use ansible to deploy the upgrade, so mentioned the data centers situation. The PostgreSQL is single node and the upgrade will be in the same data center and same Linux server(Centos 7), just will run the ansible to upgrade PG in all Data centers. For example, in our aaa data center

pg_upgrade problem as locale difference in data centers

2021-09-16 Thread Yi Sun
Hello, We want to upgrade some PG9.6 DB to PG13, the databases locale are different in data centers, some are C, some are ru_RU.UTF-8 and so on... as below postgres=# select datname,datcollate,datctype from pg_database; datname| datcollate | datctype

Re: postgresql version 13 repo question

2021-07-04 Thread Yi Sun
Yi Sun 于2021年6月30日周三 下午2:33写道: > Hello, > > As our env os version is different, some is centos 7.4, some is 7.5 and > 7.6 ..., and there is only one company repo, as I compare the packages size > and date, seems same, If we can just use 7.6 packages please? > > https://do

postgresql version 13 repo question

2021-06-30 Thread Yi Sun
Hello, As our env os version is different, some is centos 7.4, some is 7.5 and 7.6 ..., and there is only one company repo, as I compare the packages size and date, seems same, If we can just use 7.6 packages please? https://download.postgresql.org/pub/repos/yum/13/redhat/rhel-7.4-x86_64/

"index contains unexpected zero page" problem

2021-04-08 Thread Yi Sun
Hi guys, We face "index contains unexpected zero page" problem in prd postgresql 11 environment This url shows that need to backup database firstly, is it necessary? https://cloudblue.freshdesk.com/support/solutions/articles/44001889599-error-index-tablename-contains-unexpected-zero-page If

Re: Batch update million records in prd DB

2021-03-02 Thread Yi Sun
ortunately relatively small number to > update but once you get to billions this approach would not likely > work. Note that after each batch you also should call VACUUM before > starting a new one to avoid significant table bloat. > > BR, > > Kristjan > > On Wed, Feb 24, 2021 at 3:0

Re: Batch update million records in prd DB

2021-03-02 Thread Yi Sun
Hi Michael, Thank you, after create index to the temp table column, time cost become smaller Michael Lewis 于2021年3月2日周二 上午12:08写道: > 1) Don't pretend it is a left join when your where clause will turn it > into an INNER join. > LEFT JOIN pol gp ON gab.policy_id = gp.id > WHERE > > *

Re: Batch update million records in prd DB

2021-03-01 Thread Yi Sun
Hi Michael This is the script and explain plan info, please check, seems Filter remove more records took more time DO $MAIN$ DECLARE affect_count integer := 1000; processed_row_count integer := 0; BEGIN LOOP exit WHEN affect_count = 0; UPDATE app

Re: Batch update million records in prd DB

2021-02-25 Thread Yi Sun
Hi Michael, Thank you for your reply We found that each loop take time is different, it will become slower and slower, as our table is big table and join other table, even using index the last 1000 records take around 15 seconds, will it be a problem? Will other concurrent update have to wait

Batch update million records in prd DB

2021-02-24 Thread Yi Sun
Hello, Now need to update several million records in a table in prd DB, if can use batch update 1000 records and commit each time, if it will affect prd application like below sample script please? Sample script: DO $MAIN$ DECLARE affect_count integer; chunk_size CONSTANT integer :=1000;

Re: received immediate shutdown request caused cluster failover

2020-11-20 Thread Yi Sun
role, dbid, query from pg_stat_statements order by (shared_blks_hit+shared_blks_dirtied) desc limit 5; temp blk SQL select userid::regrole, dbid, query from pg_stat_statements order by temp_blks_written desc limit 5; Tom Lane 于2020年11月20日周五 下午2:17写道: > Yi Sun writes: > > Besides comm

Re: received immediate shutdown request caused cluster failover

2020-11-19 Thread Yi Sun
Hi guys, Besides command run(like pg_ctl) can cause "received immediate shutdown request" any other reason can cause this please? This production DB, support colleague said didn't run it Yi Sun 于2020年11月18日周三 上午11:54写道: > Hi all > > There are 3 nodes in our prd db in pa

received immediate shutdown request caused cluster failover

2020-11-17 Thread Yi Sun
Hi all There are 3 nodes in our prd db in patroni cluster, vm01 is leader, vm02 and vm03 are standby, vm01 received immediate shutdown request caused failover to vm02, after that vm03 received fast shutdown request As vm03 not in cluster so have to reinit vm03 What's the possible root caused