Re: BUG #14863: wrong reltuples statistics after vacuum without analyze

From: Pavel Suderevsky <psuderevsky(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14863: wrong reltuples statistics after vacuum without analyze
Date: 2017-10-24 13:11:58
Message-ID: CAEBTBzu5j_E1K1jb9OKwTZj98MPeM7V81-vadp5adRm=NhJnwA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

>
> This may or may not be the same issue Tomas Vondra reported recently; see
> https://www.postgresql.org/message-id/94f58897-861b-accf-
> a9f1-af4be816c0d3(at)2ndquadrant(dot)com
> where he posted a patch to fix the problem. Would you test that and see
> if it solves the problem for you?

I've performed tests with and without patch provided by Tomas Vondra
applied.
Conclusions:
1. Patch fixed issue with adding n_dead_tup value to reltuples.
2. Even without dead_tuples in a table, vacuum without analyze would bring
reltuples value to inconsistent state.
3. reltuples value increases with absolutely every lazy vacuum iteration.
4. Existence of dead tuples would just increase inaccuracy of reltuples
because of higher vacuum operations rate (depends on autovacuum_naptime
value) and higher iteration increment of reltuples overvaluing.
5. Bug is pretty critical, especially with big tables with high
modification rate.

Now it has been tested on 9.6.2, 9.6.3 and 9.6.5.

Please find postgresql96-vacuum-reltuples-fix-v2-tests.txt with performed
tests attached.

2017-10-20 2:58 GMT+03:00 Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>:

> psuderevsky(at)gmail(dot)com wrote:
>
> > I've faced strange behaviour of statistics state after (auto)VACUUM
> > execution without ANALYZE. While ANALYZE operation makes statistics good,
> > VACUUM breaks it to inconsistent state.
>
> This may or may not be the same issue Tomas Vondra reported recently; see
> https://www.postgresql.org/message-id/94f58897-861b-accf-
> a9f1-af4be816c0d3(at)2ndquadrant(dot)com
> where he posted a patch to fix the problem. Would you test that and see
> if it solves the problem for you?
>
> --
> Álvaro Herrera https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

Attachment Content-Type Size
postgresql96-vacuum-reltuples-fix-v2-tests.txt text/plain 17.8 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-10-24 14:18:40 Re: Possible regression in 'UPDATE ... SET (<column list>) = <row expression>' with just one single column/row value since v10
Previous Message YasonTR 2017-10-24 12:00:43 Possible regression in 'UPDATE ... SET (<column list>) = <row expression>' with just one single column/row value since v10