Extremely slow autovacuum:vacuum to prevent wraparound
Hi Experts, I am running a PG10.4 in a RHEL 6.9. The tables stored in my database are mainly used for reads and very less writes happen. I have recently joined this environment and as soon as I logged into the postgresql servers, checked for dead tuples and relfrozenids.. And almost all have reached the autovacuum_freeze_max_age of 2billion and autovacuum was disabled.. Last vacuum was run 3 months back. Today I got permission to vacuum the tables but for 3 tables, Postgresql has already started the vacuum freeze using the autovacuum daemon running to prevent wraparound and these tables have TB'S of data.Experts, please confirm whether I can kill these sessions and run a manual vacuum job with parallel jobs. Thanks in advance. Regards, Rijo Roy Sent from Yahoo Mail on Android
Re: Extremely slow autovacuum:vacuum to prevent wraparound
+pgsql-general Sent from Yahoo Mail on Android On Wed, 11 Jul 2018 at 5:43 pm, Rijo Roy wrote: Hi Ravi, It was the application teams call to disable it fearing the alteration of execution plans and slowness as per their explanation. I have joined 2 days back and I have tried educating them for enabling the same but they said after enough testing and evidence collected it will be enabled back in future.. As of now, I have started the manual vacuum operation on the databases but in one of them I am facing this issue that my vacuum jobs for 3 tables are paused as there are 3 autovacuum jobs running since 5 days on the same tables to prevent wraparound. Could you please confirm whether I can stop these autovacuum jobs so that I can run my manual run of vaccum job. Thanks, Rijo Roy Sent from Yahoo Mail on Android On Wed, 11 Jul 2018 at 5:37 pm, Ravi Krishna wrote: Who disabled auto vacuum and why ? Basically you are paying the price for it now Sent from my iPad On Jul 11, 2018, at 7:33 AM, Rijo Roy wrote: Hi Experts, I am running a PG10.4 in a RHEL 6.9. The tables stored in my database are mainly used for reads and very less writes happen. I have recently joined this environment and as soon as I logged into the postgresql servers, checked for dead tuples and relfrozenids.. And almost all have reached the autovacuum_freeze_max_age of 2billion and autovacuum was disabled.. Last vacuum was run 3 months back. Today I got permission to vacuum the tables but for 3 tables, Postgresql has already started the vacuum freeze using the autovacuum daemon running to prevent wraparound and these tables have TB'S of data.Experts, please confirm whether I can kill these sessions and run a manual vacuum job with parallel jobs. Thanks in advance. Regards, Rijo Roy Sent from Yahoo Mail on Android
Re: Extremely slow autovacuum:vacuum to prevent wraparound
No, I have 3 sessions of autovacuum against 3 tables which is doing a Vacuum to prevent wraparound as it hit the limit of autovacuum_freeze_max_age of 2 billion. I also have a vaccumdb session which is invoked by me on these tables which is currently in paused state. So, I want to know whether I can kill the autivacuum sessions which is running since 5 days and extremely slow and just run a manual vacuum against these tables instead. Sent from Yahoo Mail on Android On Wed, 11 Jul 2018 at 6:36 pm, Ravi Krishna wrote: Are you telling that you have multiple autovac on the same table? If yes, that causes lock waits. === Original Message=== On Jul 11, 2018, at 08:13 , Rijo Roy wrote: Hi Ravi, It was the application teams call to disable it fearing the alteration of execution plans and slowness as per their explanation. I have joined 2 days back and I have tried educating them for enabling the same but they said after enough testing and evidence collected it will be enabled back in future.. As of now, I have started the manual vacuum operation on the databases but in one of them I am facing this issue that my vacuum jobs for 3 tables are paused as there are 3 autovacuum jobs running since 5 days on the same tables to prevent wraparound. Could you please confirm whether I can stop these autovacuum jobs so that I can run my manual run of vaccum job. Thanks, Rijo Roy Sent from Yahoo Mail on Android On Wed, 11 Jul 2018 at 5:37 pm, Ravi Krishna wrote: Who disabled auto vacuum and why ? Basically you are paying the price for it now Sent from my iPad On Jul 11, 2018, at 7:33 AM, Rijo Roy wrote: Hi Experts, I am running a PG10.4 in a RHEL 6.9. The tables stored in my database are mainly used for reads and very less writes happen. I have recently joined this environment and as soon as I logged into the postgresql servers, checked for dead tuples and relfrozenids.. And almost all have reached the autovacuum_freeze_max_age of 2billion and autovacuum was disabled.. Last vacuum was run 3 months back. Today I got permission to vacuum the tables but for 3 tables, Postgresql has already started the vacuum freeze using the autovacuum daemon running to prevent wraparound and these tables have TB'S of data.Experts, please confirm whether I can kill these sessions and run a manual vacuum job with parallel jobs. Thanks in advance. Regards, Rijo Roy Sent from Yahoo Mail on Android
RE: Extremely slow autovacuum:vacuum to prevent wraparound
Hi Steve, Apologies, I misread it as 2 billion, it is as you said set as 200 million which is the default value for the parameter autovacuum_freeze_max_age. I just wanted to confirm whether there would be any impact if I cancel or terminate the backend for the existing autovacuum :vacuum table_name (to prevent wraparound). I have initiated a normal vacuum manually but it is stuck on the table where the autovacuum is processing it. Thanks, Rijo Roy Sent from Yahoo Mail on Android On Wed, 11 Jul 2018 at 7:30 pm, Steven Winfield wrote: #yiv7029743585 #yiv7029743585 -- _filtered #yiv7029743585 {panose-1:2 2 6 9 4 2 5 8 3 4;} _filtered #yiv7029743585 {panose-1:2 2 6 9 4 2 5 8 3 4;} _filtered #yiv7029743585 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;} _filtered #yiv7029743585 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;} _filtered #yiv7029743585 {panose-1:2 2 6 9 4 2 5 8 3 4;}#yiv7029743585 #yiv7029743585 p.yiv7029743585MsoNormal, #yiv7029743585 li.yiv7029743585MsoNormal, #yiv7029743585 div.yiv7029743585MsoNormal {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;font-family:New;}#yiv7029743585 a:link, #yiv7029743585 span.yiv7029743585MsoHyperlink {color:blue;text-decoration:underline;}#yiv7029743585 a:visited, #yiv7029743585 span.yiv7029743585MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv7029743585 span.yiv7029743585EmailStyle17 {color:#1F497D;}#yiv7029743585 .yiv7029743585MsoChpDefault {} _filtered #yiv7029743585 {margin:72.0pt 72.0pt 72.0pt 72.0pt;}#yiv7029743585 div.yiv7029743585WordSection1 {}#yiv7029743585 From: Rijo Roy [mailto:rjo_...@yahoo.com] Sent: 11 July 2018 14:30 To: srkris...@yahoo.com Cc: pgsql-gene...@postgresql.org Subject: Re: Extremely slow autovacuum:vacuum to prevent wraparound No, I have 3 sessions of autovacuum against 3 tables which is doing a Vacuum to prevent wraparound as it hit the limit of autovacuum_freeze_max_age of 2 billion. I also have a vaccumdb session which is invoked by me on these tables which is currently in paused state. So, I want to know whether I can kill the autivacuum sessions which is running since 5 days and extremely slow and just run a manual vacuum against these tables instead. Is your autovacuum_freeze_max_age really set to 2 billion? The default value is 200 million. Setting it that high and disabling autovacuum isn’t just silly - it borders on sabotage! I’ve used pg_cancel_backend() (NOT pg_terminate_backend()) on autovacuum jobs before without issue. Good luck! Steve. This email is confidential. If you are not the intended recipient, please advise us immediately and delete this message. The registered name of Cantab- part of GAM Systematic is Cantab Capital Partners LLP. See - http://www.gam.com/en/Legal/Email+disclosures+EU for further information on confidentiality, the risks of non-secure electronic communication, and certain disclosures which we are required to make in accordance with applicable legislation and regulations. If you cannot access this link, please notify us by reply message and we will send the contents to you. GAM Holding AG and its subsidiaries (Cantab – GAM Systematic) will collect and use information about you in the course of your interactions with us. Full details about the data types we collect and what we use this for and your related rights is set out in our online privacy policy at https://www.gam.com/en/legal/privacy-policy. Please familiarise yourself with this policy and check it from time to time for updates as it supplements this notice
RE: Extremely slow autovacuum:vacuum to prevent wraparound
Thanks a lot Steve, that really answers my question.. Many thanks, Rijo Roy Sent from Yahoo Mail on Android On Wed, 11 Jul 2018 at 7:50 pm, Steven Winfield wrote: #yiv8600935552 #yiv8600935552 -- _filtered #yiv8600935552 {panose-1:2 2 6 9 4 2 5 8 3 4;} _filtered #yiv8600935552 {panose-1:2 2 6 9 4 2 5 8 3 4;} _filtered #yiv8600935552 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;} _filtered #yiv8600935552 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;} _filtered #yiv8600935552 {panose-1:2 2 6 9 4 2 5 8 3 4;} _filtered #yiv8600935552 {font-family:New;panose-1:0 0 0 0 0 0 0 0 0 0;}#yiv8600935552 #yiv8600935552 p.yiv8600935552MsoNormal, #yiv8600935552 li.yiv8600935552MsoNormal, #yiv8600935552 div.yiv8600935552MsoNormal {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;font-family:New;}#yiv8600935552 a:link, #yiv8600935552 span.yiv8600935552MsoHyperlink {color:blue;text-decoration:underline;}#yiv8600935552 a:visited, #yiv8600935552 span.yiv8600935552MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv8600935552 p.yiv8600935552msonormal, #yiv8600935552 li.yiv8600935552msonormal, #yiv8600935552 div.yiv8600935552msonormal {margin-right:0cm;margin-left:0cm;font-size:12.0pt;font-family:New;}#yiv8600935552 span.yiv8600935552msohyperlink {}#yiv8600935552 span.yiv8600935552msohyperlinkfollowed {}#yiv8600935552 span.yiv8600935552emailstyle17 {}#yiv8600935552 p.yiv8600935552msonormal1, #yiv8600935552 li.yiv8600935552msonormal1, #yiv8600935552 div.yiv8600935552msonormal1 {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}#yiv8600935552 span.yiv8600935552msohyperlink1 {color:blue;text-decoration:underline;}#yiv8600935552 span.yiv8600935552msohyperlinkfollowed1 {color:purple;text-decoration:underline;}#yiv8600935552 span.yiv8600935552emailstyle171 {color:#1F497D;}#yiv8600935552 span.yiv8600935552EmailStyle25 {color:#1F497D;}#yiv8600935552 .yiv8600935552MsoChpDefault {} _filtered #yiv8600935552 {margin:72.0pt 72.0pt 72.0pt 72.0pt;}#yiv8600935552 div.yiv8600935552WordSection1 {}#yiv8600935552 From: Rijo Roy [mailto:rjo_...@yahoo.com] Sent: 11 July 2018 15:14 To: Steven Winfield Cc: pgsql-gene...@postgresql.org Subject: RE: Extremely slow autovacuum:vacuum to prevent wraparound Hi Steve, Apologies, I misread it as 2 billion, it is as you said set as 200 million which is the default value for the parameter autovacuum_freeze_max_age. I just wanted to confirm whether there would be any impact if I cancel or terminate the backend for the existing autovacuum :vacuum table_name (to prevent wraparound). I have initiated a normal vacuum manually but it is stuck on the table where the autovacuum is processing it. Thanks, Rijo Roy Stack Overflow confirms my memories about killing autovacuum - pg_cancel_backend() should be fine. https://stackoverflow.com/questions/18048842/danger-in-killing-autovacuum-vacuum-queries-to-prevent-wraparound Steve. This email is confidential. If you are not the intended recipient, please advise us immediately and delete this message. The registered name of Cantab- part of GAM Systematic is Cantab Capital Partners LLP. See - http://www.gam.com/en/Legal/Email+disclosures+EU for further information on confidentiality, the risks of non-secure electronic communication, and certain disclosures which we are required to make in accordance with applicable legislation and regulations. If you cannot access this link, please notify us by reply message and we will send the contents to you. GAM Holding AG and its subsidiaries (Cantab – GAM Systematic) will collect and use information about you in the course of your interactions with us. Full details about the data types we collect and what we use this for and your related rights is set out in our online privacy policy at https://www.gam.com/en/legal/privacy-policy. Please familiarise yourself with this policy and check it from time to time for updates as it supplements this notice
Database Refresh confusion
Hello Experts, Today, my colleague asked me if there was any way to check the progress of recovery (backup-recovery) in Postgresql. I told him to check the postgresql logs and look out for keywords such as recovery. He was refreshing the database by restoring a database backup but the method he tried surprised me. The below commands were used:pg_basebackup -h remoteservername -p Port number -D /path -X s -c fast -n -P -vAnd he just started the postgresql cluster using pg_ctl I told him that he missed creating a recovery.conf with a recovery command, but he told me that he always does this way. I told him that the process is wrong and this will do a crash recovery and there are high chances of data corruption. He replied saying he never faced an issue following his process of doing it without recovery.conf 2 questions:1. Is this a good practice for refreshing data into a new server. 2. Is there any other mechanism to track the restoration process other than to check the postgresql logs. The postgresql version used in 10.0 on a Linux 6.9 Thanks, Rijo Roy Sent from Yahoo Mail on Android
Template0 datfrozenxid age is 160million and progressing
Hello Everyone, I am observing a steady increase in age(datfrozenxid) of template0 database in my Postgresql 10 running in a RHEL 6.9Currently, it is at 166846989 and I am not able to vacuum the same as datallowconn is false. Thought of setting it to true and perform a vacuum freeze on the same. Before doing that, I wanted to check whether I should be worrying for something here or can I just go ahead with my plan. Thanks, Rijo Roy Sent from Yahoo Mail on Android
Re: Template0 datfrozenxid age is 160million and progressing
Hi Tom, Thanks for the advice. Autovacuum is disabled in the environment and I cannot take a call on enabling it back. I can only run manual vacuum on the database as the dev team fears autoanalyze changing the query performance. Do you still think we don't need to take any actions. Thanks, Rijo Roy Sent from Yahoo Mail on Android On Wed, 1 Aug 2018 at 7:38 pm, Tom Lane wrote: Rijo Roy writes: > I am observing a steady increase in age(datfrozenxid) of template0 database > in my Postgresql 10 running in a RHEL 6.9Currently, it is at 166846989 and I > am not able to vacuum the same as datallowconn is false. Thought of setting > it to true and perform a vacuum freeze on the same. Before doing that, I > wanted to check whether I should be worrying for something here or can I just > go ahead with my plan. I would leave well enough alone. Unless you've changed the default values of autovacuum parameters, that behavior is perfectly normal and not worrisome. autovacuum should kick in and do something about it at 200 million xacts (autovacuum_freeze_max_age). regards, tom lane
Re: Template0 datfrozenxid age is 160million and progressing
I agree.. But unfortunately it is the business call and we cannot alter it.. I am planning to convince them by keeping autovacuum_analyze_threshold to a high value so that auto analyse will not kick in very often leaving the autovacuum to do its job.. Please advise. Thanks, Rijo Roy Sent from Yahoo Mail on Android On Wed, 1 Aug 2018 at 7:54 pm, Tom Lane wrote: Rijo Roy writes: > Thanks for the advice. Autovacuum is disabled in the environment and I cannot > take a call on enabling it back. I can only run manual vacuum on the database > as the dev team fears autoanalyze changing the query performance. Do you > still think we don't need to take any actions. IMO, the action you need to take is enabling autovacuum. We've seen many many people go down the path you are taking, and it's generally led to no good in the end. Manual vacuuming tends to miss stuff, and it cannot react adequately to activity spikes. regards, tom lane
Barman issue
Hello Experts, I have a server rhel 6.9 installed with barman 2.3 which is configured to take backup from Postgresql 10 installed in a remote host and the same is working. I am trying to do a poc on streaming backup and streaming wal method by making use of the pg_receivewal. I have already created a user with replication privilege the same is added in pg_hba. conf. And I am able to connect remotely using the user created. But when I am running barman check pg pg is the name given to the remote dB host. I am getting an error like this EXCEPTION: LooseVersion instance has no attribute 'version' Below I am pasting the conf files used: [pg] conninfo streaming_conninfo streaming_archiver = on slot_name = barman backup_method = postgres path_prefix = Postgresql bin path basebackups_directory errors_directory incoming_wals_directory streaming_wals_directory ---—--- I have already created the replication slots and started the pg_receivexlog remotely from the batman server. Was are streaming and is coming to the incoming_wals_directory Please note that there are 2 more servers configured with barman in this backup hosts which is working fine.. The o my difference theyvhave is that they are configured with backup_method = rsync. I wanted to make use of pg_receivexlog instead of rsync. Hence this poc.. Please help. Thanks, Roy Sent from Yahoo Mail on Android
Enabling autovacuum per table
Hello Experts, Is there any possibility for autovacuum to work on a user table if we set Alter table sometable set (autovacuum_enabled = true) ; even if the parameter autovacuum = off in Postgresql.conf I am using Postgresql 10 on Linux 6.9. According to me, it won't work without setting autovacuum = on except for Template0 database. What is your opinion? Thanks, Rijo Roy Sent from Yahoo Mail on Android
Re: Enabling autovacuum per table
Yeah when age(relfrozenxid) goes beyond the limit Postgresql will invoke the autovacuum session to avoid a wraparound issue.. But here that's not the case.. Sent from Yahoo Mail on Android On Mon, 15 Oct 2018 at 2:58 pm, Arthur Zakirov wrote: On 10/15/18 11:01 AM, Rijo Roy wrote: > Hello Experts, > > Is there any possibility for autovacuum to work on a user table if we set > Alter table sometable set (autovacuum_enabled = true) ; even if the > parameter autovacuum = off in Postgresql.conf > > I am using Postgresql 10 on Linux 6.9. > > According to me, it won't work without setting autovacuum = on except > for Template0 database. What is your opinion? I think you are right, autovacuum won't vacuum and analyze a table without setting autovacuum = on. But PostgreSQL might want to force vacuum if a table is at risk of wraparound. -- Arthur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company
Re: Enabling autovacuum per table
Thanks Adrian for sharing the facts and docs.. Is there a possibility to disable auto analyze if we set autovacuum_analyze_scale_factor to 100% and autovacuum_analyze_threshold = 0? Thanks, Rijo Roy Sent from Yahoo Mail on Android On Mon, 15 Oct 2018 at 6:48 pm, Adrian Klaver wrote: On 10/15/18 1:01 AM, Rijo Roy wrote: > Hello Experts, > > Is there any possibility for autovacuum to work on a user table if we set > Alter table sometable set (autovacuum_enabled = true) ; even if the > parameter autovacuum = off in Postgresql.conf > > I am using Postgresql 10 on Linux 6.9. > > According to me, it won't work without setting autovacuum = on except > for Template0 database. What is your opinion? The docs opinion: https://www.postgresql.org/docs/10/static/sql-createtable.html "autovacuum_enabled, toast.autovacuum_enabled (boolean) Enables or disables the autovacuum daemon for a particular table. If true, the autovacuum daemon will perform automatic VACUUM and/or ANALYZE operations on this table following the rules discussed in Section 24.1.6. If false, this table will not be autovacuumed, except to prevent transaction ID wraparound. See Section 24.1.5 for more about wraparound prevention. Note that the autovacuum daemon does not run at all (except to prevent transaction ID wraparound) if the autovacuum parameter is false; setting individual tables' storage parameters does not override that. Therefore there is seldom much point in explicitly setting this storage parameter to true, only to false. " > > Thanks, > Rijo Roy > > Sent from Yahoo Mail on Android > <https://go.onelink.me/107872968?pid=InProduct&c=Global_Internal_YGrowth_AndroidEmailSig__AndroidUsers_wl=ym_sub1=Internal_sub2=Global_YGrowth_sub3=EmailSignature> -- Adrian Klaver adrian.kla...@aklaver.com
Wals not recycling
Hi All, I am facing an issue with wal recycling in one of my Postgresql servers running ina rhel box and the PG version is 10. The issue is that wal files are not recycling at all. Please note that its a qa server and the load is quite high on it. It is running in no archive mode with fsync on, max_wal_size is 8GB with checkpoint_timeout of 5mins and default checkpoint_completion_target of 0.5. Could you please give me some pointers what could be wrong, if it is hardware that is problem here, how can I collect some facts about it so that 8 can take this matter with system guys. Average wal generation is approximately 9k per day I have enabled log_checkpoint in my server and I can see it says checkpoint complete: wrote ###buffers, 0 wal files added, 0 removed, 0 recycled LogCheckpointEnd I have no active replication slots in this database cluster.Also the wal_keep_segments is set to 0. Appreciate your help! Thanks, Rijo Roy Sent from Yahoo Mail on Android
Re: Wals not recycling
Yes Ian, it worked.. Many Thanks,Rijo Roy On Friday, 21 December, 2018, 4:16:09 AM IST, Ian Lawrence Barwick wrote: 2018年12月20日(木) 21:58 Rijo Roy : > > Thanks sk for replying Ian.. I have one inactive replication slot in the > database. I suspected that could be the cause but was not sure of it. Could > you please tell me what I should be doing in this case. Can I drop the > replication slot since it is no more used and delete old wal files or will PG > be able to recycle them by itself. Yes, just drop the replication slot and the excess files will be removed. Regards Ian Barwick -- Ian Barwick http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Refresh using barman
Hi All, Hi all, I need some help over barman..Recently, I refreshed one of non-prod environments with production database and I ran into this problem or rather unforeseen point that I cannot change the system catalogs ownership to the respective non prod owner account. And I really don't want to tamper the system catalogs in any manner. Is there a solution for this? PostgreSQL 10 and barman 2.4 on rhel 7 is my environment. Thanks, Rijo Roy Sent from Yahoo Mail on Android