vacuumdb idle processes
vacuumdb idle processes
От:
Nikhil Shetty <nikhil.dba04@gmail.com>
Дата:
Hi,
I have done a setup to run vacuumdb with 8 parallel jobs daily. It has been running quite well.
Just today I saw there is an aggressive autovacuum process running(to prevent wraparound) on one of the table. vacuumdb which started later spawned the 8 connections. One connection (doing vacuum on the table on which an aggressive autovacuum is running) is waiting for "autovacuum(to prevent wraparound)" to complete while the other 7 connections are just sitting idle.
I am okay that one connection is waiting since an aggressive autovacuum is running on that table but how come other connections have not released the sesion yet? Any reason for this?
Thanks,
Nikhil
Re: vacuumdb idle processes
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Nikhil Shetty writes: > I have done a setup to run vacuumdb with 8 parallel jobs daily. It has been > running quite well. Apparently not all that well, if it failed to keep us out of an autovacuum-to-prevent-wraparound situation. I suppose you had autovacuum disabled because you thought this lashup was sufficient? > Just today I saw there is an aggressive autovacuum process running(to > prevent wraparound) on one of the table. vacuumdb which started later > spawned the 8 connections. One connection (doing vacuum on the table on > which an aggressive autovacuum is running) is waiting for "autovacuum(to > prevent wraparound)" to complete while the other 7 connections are just > sitting idle. > I am okay that one connection is waiting since an aggressive autovacuum is > running on that table but how come other connections have not released the > sesion yet? Any reason for this? Perhaps this is the last remaining table so vacuumdb has nothing else for them to do. regards, tom lane
Re: vacuumdb idle processes
От:
Nikhil Shetty <nikhil.dba04@gmail.com>
Дата:
Hi Tom,
Apparently not all that well, if it failed to keep us out of an
autovacuum-to-prevent-wraparound situation. I suppose you had autovacuum
disabled because you thought this lashup was sufficient?
No, autovacuum was enabled but seems it was not able to catch up with the amount of transaction or it might have been delayed due to postgres favouring other txns that conflict -- Need to check this though
Perhaps this is the last remaining table so vacuumdb has nothing
else for them to do.
Does this mean vacuumdb will release all db connections(jobs - 8 in this case) only after all connections have performed their vacuum and then disconnected? Even if one is pending the others will be still connected but in idle state? Is my understanding correct?
Thanks and Regards,
Nikhil
On Sat, Jun 12, 2021 at 12:03 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Nikhil Shetty <nikhil.dba04@gmail.com> writes:
> I have done a setup to run vacuumdb with 8 parallel jobs daily. It has been
> running quite well.
Apparently not all that well, if it failed to keep us out of an
autovacuum-to-prevent-wraparound situation. I suppose you had autovacuum
disabled because you thought this lashup was sufficient?
> Just today I saw there is an aggressive autovacuum process running(to
> prevent wraparound) on one of the table. vacuumdb which started later
> spawned the 8 connections. One connection (doing vacuum on the table on
> which an aggressive autovacuum is running) is waiting for "autovacuum(to
> prevent wraparound)" to complete while the other 7 connections are just
> sitting idle.
> I am okay that one connection is waiting since an aggressive autovacuum is
> running on that table but how come other connections have not released the
> sesion yet? Any reason for this?
Perhaps this is the last remaining table so vacuumdb has nothing
else for them to do.
regards, tom lane
Re: vacuumdb idle processes
От:
Nikhil Shetty <nikhil.dba04@gmail.com>
Дата:
Hi,
I tested this scenario and it seems if vacuumdb is started with multiple jobs and one of the jobs doesn't complete due to a lock or whatever reason, other jobs will stay idle and don't release the connection until the stuck job is finished.
For my understanding, why do we need this behaviour?
Thanks and Regards,
Nikhil
On Sat, Jun 12, 2021 at 12:34 PM Nikhil Shetty <nikhil.dba04@gmail.com> wrote:
Hi Tom,Apparently not all that well, if it failed to keep us out of an
autovacuum-to-prevent-wraparound situation. I suppose you had autovacuum
disabled because you thought this lashup was sufficient?No, autovacuum was enabled but seems it was not able to catch up with the amount of transaction or it might have been delayed due to postgres favouring other txns that conflict -- Need to check this thoughPerhaps this is the last remaining table so vacuumdb has nothing
else for them to do.Does this mean vacuumdb will release all db connections(jobs - 8 in this case) only after all connections have performed their vacuum and then disconnected? Even if one is pending the others will be still connected but in idle state? Is my understanding correct?Thanks and Regards,NikhilOn Sat, Jun 12, 2021 at 12:03 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:Nikhil Shetty <nikhil.dba04@gmail.com> writes:
> I have done a setup to run vacuumdb with 8 parallel jobs daily. It has been
> running quite well.
Apparently not all that well, if it failed to keep us out of an
autovacuum-to-prevent-wraparound situation. I suppose you had autovacuum
disabled because you thought this lashup was sufficient?
> Just today I saw there is an aggressive autovacuum process running(to
> prevent wraparound) on one of the table. vacuumdb which started later
> spawned the 8 connections. One connection (doing vacuum on the table on
> which an aggressive autovacuum is running) is waiting for "autovacuum(to
> prevent wraparound)" to complete while the other 7 connections are just
> sitting idle.
> I am okay that one connection is waiting since an aggressive autovacuum is
> running on that table but how come other connections have not released the
> sesion yet? Any reason for this?
Perhaps this is the last remaining table so vacuumdb has nothing
else for them to do.
regards, tom lane
Re: vacuumdb idle processes
От:
Jeff Janes <jeff.janes@gmail.com>
Дата:
On Fri, Jun 11, 2021 at 1:58 PM Nikhil Shetty <nikhil.dba04@gmail.com> wrote:
Hi,I have done a setup to run vacuumdb with 8 parallel jobs daily. It has been running quite well.
What version of PostgreSQL is this? What options do you run vacuumdb with? Is it run as a superuser?
Cheers,
Jeff
Re: vacuumdb idle processes
От:
Nikhil Shetty <nikhil.dba04@gmail.com>
Дата:
Hi Jeff,
What version of PostgreSQL is this?
Postgres version is 11.7.
What options do you run vacuumdb with?
Command is vacuumdb -avz -j 4
Is it run as a superuser?
Yes, it is run as a superuser
On Sun, Jun 13, 2021 at 7:39 PM Jeff Janes <jeff.janes@gmail.com> wrote:
On Fri, Jun 11, 2021 at 1:58 PM Nikhil Shetty <nikhil.dba04@gmail.com> wrote:Hi,I have done a setup to run vacuumdb with 8 parallel jobs daily. It has been running quite well.What version of PostgreSQL is this? What options do you run vacuumdb with? Is it run as a superuser?Cheers,Jeff
Re: vacuumdb idle processes
От:
Jeff Janes <jeff.janes@gmail.com>
Дата:
On Sun, Jun 13, 2021 at 8:43 AM Nikhil Shetty <nikhil.dba04@gmail.com> wrote:
Hi,I tested this scenario and it seems if vacuumdb is started with multiple jobs and one of the jobs doesn't complete due to a lock or whatever reason, other jobs will stay idle and don't release the connection until the stuck job is finished.For my understanding, why do we need this behaviour?
I don't think we **need** this behavior, it is just a simple way to wait for each one to finish and then close it; waiting for each specific one in the order it is present in the list. Is there an important reason we need a more complex behavior, closing each one as soon as it becomes idle once the work queue is empty?
Cheers,
Jeff
Re: vacuumdb idle processes
От:
Ron <ronljohnsonjr@gmail.com>
Дата:
On 6/15/21 3:20 PM, Jeff Janes wrote:
"Disconnect when you're finished" is Best Practice, no?
On Sun, Jun 13, 2021 at 8:43 AM Nikhil Shetty <nikhil.dba04@gmail.com> wrote:Hi,I tested this scenario and it seems if vacuumdb is started with multiple jobs and one of the jobs doesn't complete due to a lock or whatever reason, other jobs will stay idle and don't release the connection until the stuck job is finished.For my understanding, why do we need this behaviour?I don't think we **need** this behavior, it is just a simple way to wait for each one to finish and then close it; waiting for each specific one in the order it is present in the list. Is there an important reason we need a more complex behavior, closing each one as soon as it becomes idle once the work queue is empty?
"Disconnect when you're finished" is Best Practice, no?
--
Angular momentum makes the world go 'round.
Angular momentum makes the world go 'round.
Re: vacuumdb idle processes
От:
Nikhil Shetty <nikhil.dba04@gmail.com>
Дата:
Hi Jeff,
I don't think we **need** this behavior, it is just a simple way to wait for each one to finish and then close it; waiting for each specific one in the order it is present in the list. Is there an important reason we need a more complex behavior, closing each one as soon as it becomes idle once the work queue is empty?
Reason for releasing connections in my case would be the "autovacuum (to prevent wraparound)" taking time to complete . This process should finish to completion to prevent any issues in the databases due to wraparound and it will take some time if the table is big and contains many dead tuples. If vacuumdb starts with 10 parallel jobs during this period, one of the jobs will be locked(by autovacuum) and the other nine will be idle(after finishing their part) for days just wasting connections until we terminate the locked process.
Thanks and Regards,
Nikhil
On Wed, Jun 16, 2021 at 1:50 AM Jeff Janes <jeff.janes@gmail.com> wrote:
On Sun, Jun 13, 2021 at 8:43 AM Nikhil Shetty <nikhil.dba04@gmail.com> wrote:Hi,I tested this scenario and it seems if vacuumdb is started with multiple jobs and one of the jobs doesn't complete due to a lock or whatever reason, other jobs will stay idle and don't release the connection until the stuck job is finished.For my understanding, why do we need this behaviour?I don't think we **need** this behavior, it is just a simple way to wait for each one to finish and then close it; waiting for each specific one in the order it is present in the list. Is there an important reason we need a more complex behavior, closing each one as soon as it becomes idle once the work queue is empty?Cheers,Jeff