Re: Heavily modified big table bloat even in auto vacuum is running

From: Haribabu kommi <haribabu(dot)kommi(at)huawei(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Heavily modified big table bloat even in auto vacuum is running
Date: 2013-10-22 08:39:46
Message-ID: 8977CB36860C5843884E0A18D8747B0372BC9AC4@szxeml558-mbs.china.huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 22 October 2013 10:15 Amit Kapila wrote:
>>On Mon, Oct 21, 2013 at 10:54 AM, Haribabu kommi <haribabu(dot)kommi(at)huawei(dot)com> wrote:
>>
>> Yes, it's correct. "nkeep" counter have the dead tuples which are recently dead and are not vacuumed. The removal of tuples vacuumed from dead tuples should be the same as "nkeep" counter.
>> So if we remove the nkeep from num_tuples which gives us the proper live tuples. How about following statement at the end scan for all blocks.
>>
>> num_tuples -= nkeep;
>
>Actually what I had in mind was to use nkeep to estimate n_dead_tuples similar to how num_tuples is used to estimate n_live_tuples. I think it will match what Tom had pointed in his response (>>>>What
>>would make more sense to me is for VACUUM to estimate the number
>>>>>of remaining dead tuples somehow and send that in its message.
>>>>>However, since the whole point here is that we aren't accounting for
>>>>>transactions that commit while VACUUM runs, it's not very clear how
>>>>>to do that.)

I changed the patch as passing the "nkeep" counter data as the new dead tuples in the relation to stats like the new_rel_tuples.
The "nkeep" counter is an approximation of dead tuples data of a relation.
Instead of resetting dead tuples stats as zero, used this value to set n_dead_tuples same as n_live_tuples.

Patch is attached in the mail. Please let me know if any changes are required.

Regards,
Hari Babu.

Attachment Content-Type Size
vacuum_fix_v3.patch application/octet-stream 4.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Manlio Perillo 2013-10-22 08:42:12 Re: Why the asprintf patch is still breaking the buildfarm
Previous Message David Rowley 2013-10-22 08:22:22 Re: Why the asprintf patch is still breaking the buildfarm