Обсуждение: Vacuum

Поиск
Список
Период
Сортировка

Vacuum

От
Rajesh Kumar
Дата:
Postgres 15

I am creating a new replica, and after the data is caught up and replication lag is 0, I am doing a switchover and making a new replica as master.

Now, in this case, do I have so vacuum analyze in master?

Re: Vacuum

От
SOzcn
Дата:
Hello, I've tried the same thing, you need to analyze your databases in any case. Don't need a Full vacuum.

Rajesh Kumar <rajeshkumar.dba09@gmail.com>, 2 Oca 2024 Sal, 18:07 tarihinde şunu yazdı:
Postgres 15

I am creating a new replica, and after the data is caught up and replication lag is 0, I am doing a switchover and making a new replica as master.

Now, in this case, do I have so vacuum analyze in master?

Re: Vacuum

От
Laurenz Albe
Дата:
On Tue, 2024-01-02 at 18:33 +0300, SOzcn wrote:
> Rajesh Kumar <rajeshkumar.dba09@gmail.com>, 2 Oca 2024 Sal, 18:07 tarihinde şunu yazdı:
> > Postgres 15
> >
> > I am creating a new replica, and after the data is caught up and replication lag is 0,
> > I am doing a switchover and making a new replica as master.
> >
> > Now, in this case, do I have so vacuum analyze in master?
>
> Hello, I've tried the same thing, you need to analyze your databases in any case.
> Don't need a Full vacuum.

I don't think that is true.
Both table statistics and the effects of VACUUM are replicated.

What is not replicated are the statistics in "pg_stat_all_tables", so autovacuum
loses its brain during a switchover.

Yours,
Laurenz Albe



Re: Vacuum

От
Rajesh Kumar
Дата:
Vacuum operation happens only in primary. How is that replicated?

On Wed, 3 Jan 2024, 01:04 Laurenz Albe, <laurenz.albe@cybertec.at> wrote:
On Tue, 2024-01-02 at 18:33 +0300, SOzcn wrote:
> Rajesh Kumar <rajeshkumar.dba09@gmail.com>, 2 Oca 2024 Sal, 18:07 tarihinde şunu yazdı:
> > Postgres 15
> >
> > I am creating a new replica, and after the data is caught up and replication lag is 0,
> > I am doing a switchover and making a new replica as master.
> >
> > Now, in this case, do I have so vacuum analyze in master?
>
> Hello, I've tried the same thing, you need to analyze your databases in any case.
> Don't need a Full vacuum.

I don't think that is true.
Both table statistics and the effects of VACUUM are replicated.

What is not replicated are the statistics in "pg_stat_all_tables", so autovacuum
loses its brain during a switchover.

Yours,
Laurenz Albe

Re: Vacuum

От
Laurenz Albe
Дата:
On Wed, 2024-01-03 at 01:22 +0530, Rajesh Kumar wrote:
> Vacuum operation happens only in primary. How is that replicated?

VACUUM modifies data, data modifications are WAL logged, the WAL
is replayed on the standby.

Yours,
Laurenz Albe



Re: Vacuum

От
Rajesh Kumar
Дата:
Vacuum removes dead tuples in primary. Are you saying,  dead tuples are removed in replica?

On Wed, 3 Jan 2024, 15:53 Laurenz Albe, <laurenz.albe@cybertec.at> wrote:
On Wed, 2024-01-03 at 01:22 +0530, Rajesh Kumar wrote:
> Vacuum operation happens only in primary. How is that replicated?

VACUUM modifies data, data modifications are WAL logged, the WAL
is replayed on the standby.

Yours,
Laurenz Albe

Re: Vacuum

От
Ron Johnson
Дата:
Streaming Replication is file-level replication.  Therefore, if a file in $PGDATA is modified by a Postgresql program, then the file will be replicated.

VACUUM is a Postgresql "program" that modifies files.

On Wed, Jan 3, 2024 at 6:08 AM Rajesh Kumar <rajeshkumar.dba09@gmail.com> wrote:
Vacuum removes dead tuples in primary. Are you saying,  dead tuples are removed in replica?

On Wed, 3 Jan 2024, 15:53 Laurenz Albe, <laurenz.albe@cybertec.at> wrote:
On Wed, 2024-01-03 at 01:22 +0530, Rajesh Kumar wrote:
> Vacuum operation happens only in primary. How is that replicated?

VACUUM modifies data, data modifications are WAL logged, the WAL
is replayed on the standby.

Yours,
Laurenz Albe

Re: Vacuum

От
"David G. Johnston"
Дата:
On Wed, Jan 3, 2024 at 4:08 AM Rajesh Kumar <rajeshkumar.dba09@gmail.com> wrote:
Vacuum removes dead tuples in primary. Are you saying,  dead tuples are removed in replica?


The fact that the space those removed tuples occupied gets reused when creating new tuples should be enough knowledge to figure out the answer to that question.

David J.

Re: Vacuum

От
Laurenz Albe
Дата:
On Wed, 2024-01-03 at 16:38 +0530, Rajesh Kumar wrote:
> Vacuum removes dead tuples in primary. Are you saying,  dead tuples are removed in replica?

Yes.

Yours,
Laurenz Albe