pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Per-Table vacuum_freeze_min_age
6+ messages / 3 participants
[nested] [flat]

* Per-Table vacuum_freeze_min_age
@ 2022-04-06 22:13  Chris Bisnett <cbisnett@gmail.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Chris Bisnett @ 2022-04-06 22:13 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hi all!

I have several large tables (1-2Tb) that are 99.9% writes (small number of
updates) with a decent commit rate (20K/sec). The basic idea is that it’s
generating a lot of data continuously. When the table would reach the
thresholds for autovacuum a vacuum would start and would start generating
wal write lock wait events. Once I set the freeze age to 500,000 (default
is 50,000,000) the vacuums have to touch many fewer pages and is
significantly faster without causing any write lock wait events.

The only downside I’ve seen is that this is a global setting and my
understanding is that this would cause decreased performance when used with
tables with a lot of writes and deletes. Is there a technical reason this
setting cannot be applied at the database or table context like other
autovacuum settings?

- chris

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Per-Table vacuum_freeze_min_age
@ 2022-04-06 22:22  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Chris Bisnett <cbisnett@gmail.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-04-06 22:22 UTC (permalink / raw)
  To: Chris Bisnett <cbisnett@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

Chris Bisnett <cbisnett@gmail.com> writes:
> The only downside I’ve seen is that this is a global setting and my
> understanding is that this would cause decreased performance when used with
> tables with a lot of writes and deletes. Is there a technical reason this
> setting cannot be applied at the database or table context like other
> autovacuum settings?

There's an autovacuum_freeze_min_age reloption, isn't that
what you need?

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Per-Table vacuum_freeze_min_age
@ 2022-04-06 22:24  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Chris Bisnett <cbisnett@gmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Adrian Klaver @ 2022-04-06 22:24 UTC (permalink / raw)
  To: Chris Bisnett <cbisnett@gmail.com>; pgsql-general@lists.postgresql.org

On 4/6/22 3:13 PM, Chris Bisnett wrote:
> Hi all!
> 
> I have several large tables (1-2Tb) that are 99.9% writes (small number 
> of updates) with a decent commit rate (20K/sec). The basic idea is that 
> it’s generating a lot of data continuously. When the table would reach 
> the thresholds for autovacuum a vacuum would start and would start 
> generating wal write lock wait events. Once I set the freeze age to 
> 500,000 (default is 50,000,000) the vacuums have to touch many fewer 
> pages and is significantly faster without causing any write lock wait 
> events.
> 
> The only downside I’ve seen is that this is a global setting and my 
> understanding is that this would cause decreased performance when used 
> with tables with a lot of writes and deletes. Is there a technical 
> reason this setting cannot be applied at the database or table context 
> like other autovacuum settings?

It can:

https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS

Per-table value for vacuum_freeze_min_age parameter.
> 
> - chris
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Per-Table vacuum_freeze_min_age
@ 2022-04-06 22:28  Chris Bisnett <cbisnett@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Chris Bisnett @ 2022-04-06 22:28 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general@lists.postgresql.org

On Wed, Apr 6, 2022 at 6:24 PM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 4/6/22 3:13 PM, Chris Bisnett wrote:
> > Hi all!
> >
> > I have several large tables (1-2Tb) that are 99.9% writes (small number
> > of updates) with a decent commit rate (20K/sec). The basic idea is that
> > it’s generating a lot of data continuously. When the table would reach
> > the thresholds for autovacuum a vacuum would start and would start
> > generating wal write lock wait events. Once I set the freeze age to
> > 500,000 (default is 50,000,000) the vacuums have to touch many fewer
> > pages and is significantly faster without causing any write lock wait
> > events.
> >
> > The only downside I’ve seen is that this is a global setting and my
> > understanding is that this would cause decreased performance when used
> > with tables with a lot of writes and deletes. Is there a technical
> > reason this setting cannot be applied at the database or table context
> > like other autovacuum settings?
>
> It can:
>
>
> https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS
>
> Per-table value for vacuum_freeze_min_age parameter.
> >
> > - chris
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com


> Oh I must have missed this. Is this missing from the documentation here (
https://www.postgresql.org/docs/current/runtime-config-autovacuum.html)?

I can try again, but I’m pretty sure this option was rejected when I
attempted to set it via an alter table command.

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Per-Table vacuum_freeze_min_age
@ 2022-04-06 22:31  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Chris Bisnett <cbisnett@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Adrian Klaver @ 2022-04-06 22:31 UTC (permalink / raw)
  To: Chris Bisnett <cbisnett@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

On 4/6/22 3:28 PM, Chris Bisnett wrote:
> On Wed, Apr 6, 2022 at 6:24 PM Adrian Klaver <adrian.klaver@aklaver.com 
> <mailto:adrian.klaver@aklaver.com>> wrote:

> 
>     It can:
> 
>     https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS
>     <https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS;
> 
>     Per-table value for vacuum_freeze_min_age parameter.
>      >
>      > - chris
>      >
> 
> 
>     -- 
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 
> 
> Oh I must have missed this. Is this missing from the documentation here (
> https://www.postgresql.org/docs/current/runtime-config-autovacuum.html 
> <https://www.postgresql.org/docs/current/runtime-config-autovacuum.html;)?

That describes autovacuum in general. The per table options are 
attributes of a table.

> 
> I can try again, but I’m pretty sure this option was rejected when I 
> attempted to set it via an alter table command.

What was the command you used?

What was the error you got?

> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Per-Table vacuum_freeze_min_age
@ 2022-04-06 22:45  Chris Bisnett <cbisnett@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Chris Bisnett @ 2022-04-06 22:45 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general@lists.postgresql.org

On Wed, Apr 6, 2022 at 6:31 PM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 4/6/22 3:28 PM, Chris Bisnett wrote:
> > On Wed, Apr 6, 2022 at 6:24 PM Adrian Klaver <adrian.klaver@aklaver.com
> > <mailto:adrian.klaver@aklaver.com>> wrote:
>
> >
> >     It can:
> >
> >
> https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS
> >     <
> https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-STORAGE-PARAMETERS
> >
> >
> >     Per-table value for vacuum_freeze_min_age parameter.
> >      >
> >      > - chris
> >      >
> >
> >
> >     --
> >     Adrian Klaver
> >     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> >
> >
> > Oh I must have missed this. Is this missing from the documentation here (
> > https://www.postgresql.org/docs/current/runtime-config-autovacuum.html
> > <https://www.postgresql.org/docs/current/runtime-config-autovacuum.html
> >)?
>
> That describes autovacuum in general. The per table options are
> attributes of a table.
>
> >
> > I can try again, but I’m pretty sure this option was rejected when I
> > attempted to set it via an alter table command.
>
> What was the command you used?
>
> What was the error you got?
>
> >
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com


Either I was trying to use vacuum_freeze_min_age on the table or I forgot
the parenthesis around the options in the alter table command. Either way,
I just tried it and it worked. Thanks for the help!

- chris

^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2022-04-06 22:45 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 22:13 Per-Table vacuum_freeze_min_age Chris Bisnett <cbisnett@gmail.com>
2022-04-06 22:22 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-04-06 22:24 ` Adrian Klaver <adrian.klaver@aklaver.com>
2022-04-06 22:28   ` Chris Bisnett <cbisnett@gmail.com>
2022-04-06 22:31     ` Adrian Klaver <adrian.klaver@aklaver.com>
2022-04-06 22:45       ` Chris Bisnett <cbisnett@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox