public inbox for [email protected]  
help / color / mirror / Atom feed
Configure autovacuum
2+ messages / 2 participants
[nested] [flat]

* Configure autovacuum
@ 2024-06-14 06:20 Shenavai, Manuel <[email protected]>
  2024-06-14 09:17 ` Re: Configure autovacuum Ron Johnson <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Shenavai, Manuel @ 2024-06-14 06:20 UTC (permalink / raw)
  To: pgsql-general

Hi everyone,

I would like to configure the autovacuum in a way that it runs very frequently (i.e. after each update-statement). I tried the following settings on my table:
alter table mytable set (autovacuum_vacuum_scale_factor  = 0.0);
alter table mytable set (autovacuum_vacuum_cost_delay  = 0.0);
alter table mytable set (autovacuum_vacuum_cost_limit  = 10000);
alter table mytable set (autovacuum_vacuum_threshold  = 1);

I do a lot of updates on a single tuple and I would expect that the autovacuum would start basically after each update (due to autovacuum_vacuum_threshold=1). But the autovacuum is not running.

Is it possible to configure postgres to autovacuum very aggressively (i.e. after each update-statement)?

Thanks in advance &
Best regards,
Manuel


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

* Re: Configure autovacuum
  2024-06-14 06:20 Configure autovacuum Shenavai, Manuel <[email protected]>
@ 2024-06-14 09:17 ` Ron Johnson <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Ron Johnson @ 2024-06-14 09:17 UTC (permalink / raw)
  To: pgsql-general

On Fri, Jun 14, 2024 at 2:20 AM Shenavai, Manuel <[email protected]>
wrote:

> Hi everyone,
>
>
>
> I would like to configure the autovacuum in a way that it runs very
> frequently (i.e. after each update-statement). I tried the following
> settings on my table:
>
> alter table mytable set (autovacuum_vacuum_scale_factor  = 0.0);
>
> alter table mytable set (autovacuum_vacuum_cost_delay  = 0.0);
>
> alter table mytable set (autovacuum_vacuum_cost_limit  = 10000);
>
> alter table mytable set (autovacuum_vacuum_threshold  = 1);
>
>
>
> I do a lot of updates on a single tuple and I would expect that the
> autovacuum would start basically after each update (due to
> autovacuum_vacuum_threshold=1). But the autovacuum is not running.
>

HOT is probably what you're looking for:
https://www.postgresql.org/docs/14/storage-hot.html

Presuming that the field you're updating is not indexed, and the table can
be exclusively locked for as long as it takes to rewrite it: give the table
"more space to work" in each page:
ALTER TABLE foo SET (fillfactor = 30);
VACUUM FULL foo;

Then you don't need to VACUUM soooo frequently.


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


end of thread, other threads:[~2024-06-14 09:17 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-06-14 06:20 Configure autovacuum Shenavai, Manuel <[email protected]>
2024-06-14 09:17 ` Ron Johnson <[email protected]>

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