Re: When do vacuumed pages/tuples become available for reuse?

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: rihad <rihad(at)mail(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: When do vacuumed pages/tuples become available for reuse?
Date: 2019-04-11 16:09:34
Message-ID: CAMkU=1z+-o0F5PSsjhN8P98+YrYgg7odTZ+WZvocBObY-LnZLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Apr 11, 2019 at 11:44 AM rihad <rihad(at)mail(dot)ru> wrote:

> On 04/11/2019 07:40 PM, Jeff Janes wrote:
>
>
> The disk usage doesn't reach a steady state after one or two autovacs? Or
> it does, but you are just unhappy about the ratio between the steady state
> size and the theoretical fully packed size?
>
> Cheers,
>
> Jeff
>
>
> Since we dump&restore production DB daily into staging environment, the
> difference in size (as reported by psql's \l+) is 11GB in a freshly
> restored DB as opposed to 70GB in production.
>

Yeah, that seems like a problem. Do you have long lived
transactions/snapshots that are preventing vacuuming from removing dead
tuples? You can run a manual "vacuum verbose" and see how many dead but
nonremovable tuples there were, or set log_autovacuum_min_duration to some
non-negative value less than the autovac takes, and do the same.

(Indeed, those dumps you take daily might be the source of those long-lived
snapshots. How long does a dump take?)

Also, what does pg_freespace (
https://www.postgresql.org/docs/current/pgfreespacemap.html) show about the
available of space in the table? How about pgstattuple (
https://www.postgresql.org/docs/current/pgstattuple.html)

Cheers,

Jeff

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message rihad 2019-04-11 16:18:32 Re: When do vacuumed pages/tuples become available for reuse?
Previous Message Jeff Janes 2019-04-11 15:54:30 Re: When do vacuumed pages/tuples become available for reuse?