Re: [PROPOSAL] VACUUM Progress Checker.

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: "Syed, Rahila" <Rahila(dot)Syed(at)nttdata(dot)com>
Cc: Thom Brown <thom(at)linux(dot)com>, "PostgreSQL-development (pgsql-hackers(at)postgresql(dot)org)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PROPOSAL] VACUUM Progress Checker.
Date: 2015-09-16 13:01:26
Message-ID: CAD21AoDvjt9Db7V2T3psizk8yA2kkUMXzBwV-VbLRkAFU2E5Fw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 15, 2015 at 11:35 PM, Syed, Rahila <Rahila(dot)Syed(at)nttdata(dot)com> wrote:
>
> Hello Thom,
>
>>Okay, I've just tested this with a newly-loaded table (1,252,973 of jsonb data),
> Thanks a lot!
>
>>but after it's finished, I end up with this:
>>json=# select * from pg_stat_vacuum_progress;
>>-[ RECORD 1 ]-------+-------
>>pid | 5569
>>total_pages | 217941
>>scanned_pages | 175243
>>total_heap_pages | 175243
>>scanned_heap_pages | 175243
>>total_index_pages | 42698
>>scanned_index_pages |
>>percent_complete | 80
>>This was running with a VACUUM ANALYZE. This output seems to suggest that it didn't complete.
>
> Ok. The patch fails here because 'total pages to be scanned' takes into account index pages and no index pages are actually scanned.
> So the scanned pages count does not reach total pages count . I will fix this.
> It seems that no index pages were scanned during this because there were no dead tuples to be cleaned as the table was newly loaded.
>
>>After, I ran VACUUM FULL. pg_stat_vacuum_progress didn't change from before, so that doesn't appear to show up in the view.
> The scope of this patch is to report progress of basic VACUUM . It does not take into account VACUUM FULL yet. I think this can be included after basic VACUUM progress is done.
>
>>I then deleted 40,000 rows from my table, and ran VACUUM ANALYZE again. This time it progressed and percent_complete reached 100
> OK.
>

I tested this patch with some cases.
And the followings seems to be bug.

* After running "pgbench -i -s 100" and "VACUUM FREEZE
pgbench_accounts", the pg_stat_vacuum_progress is,

-[ RECORD 1 ]-------+-------
pid | 2298
total_pages | 27422
scanned_pages | 163935
total_heap_pages |
scanned_heap_pages | 163935
total_index_pages | 27422
scanned_index_pages |
percent_complete | 597

The value of percent_complete column exceeds 100%.
And, why are the total_heap_pages and scanned_index_pages columns NULL?

* Also, after dropping primary key of pgbench_accounts, I got
assertion error when I execute "VACUUM FREEZE pgbench_accounts".

=# VACUUM FREEZE pgbench_accounts;
ERROR: floating-point exception
DETAIL: An invalid floating-point operation was signaled. This
probably means an out-of-range result or an invalid operation, such as
division by zero.
STATEMENT: vacuum freeze pgbench_accounts ;
TRAP: FailedAssertion("!((beentry->st_changecount & 1) == 0)", File:
"pgstat.c", Line: 2934)

* The progress of vacuum by autovacuum seems not to be displayed.

Regards,

--
Masahiko Sawada

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message José Luis Tallón 2015-09-16 13:03:18 Re: [PROPOSAL] Covering + unique indexes.
Previous Message Simon Riggs 2015-09-16 12:50:25 Re: synchronous_commit = apply