Error correction for n_dead_tuples

Lists: pgsql-patches
From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-patches(at)postgresql(dot)org
Subject: Error correction for n_dead_tuples
Date: 2007-02-02 02:47:54
Message-ID: 20070202113602.59FF.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Here is a patch discussed in
http://archives.postgresql.org/pgsql-hackers/2007-02/msg00010.php

Concurrent vacuum will save n_dead_tuples value at the beginning.
Stats collector will be subtract the value from n_dead_tuples
instead of setting it to zero. The statistics accuracy of n_dead_tuples
will be better, especially just after finish of a vacuum.

The behavior in VACUUM FULL is not changed because concurrent updates
are not allowed during VACUUM FULL.

Comments welcome.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
n_dead_tuples.patch application/octet-stream 5.2 KB

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Error correction for n_dead_tuples
Date: 2007-02-20 01:15:26
Message-ID: 200702200115.l1K1FQG06952@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------

ITAGAKI Takahiro wrote:
> Here is a patch discussed in
> http://archives.postgresql.org/pgsql-hackers/2007-02/msg00010.php
>
> Concurrent vacuum will save n_dead_tuples value at the beginning.
> Stats collector will be subtract the value from n_dead_tuples
> instead of setting it to zero. The statistics accuracy of n_dead_tuples
> will be better, especially just after finish of a vacuum.
>
> The behavior in VACUUM FULL is not changed because concurrent updates
> are not allowed during VACUUM FULL.
>
> Comments welcome.
>
> Regards,
> ---
> ITAGAKI Takahiro
> NTT Open Source Software Center

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Error correction for n_dead_tuples
Date: 2007-02-20 01:40:55
Message-ID: 20070220014055.GE28395@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Bruce Momjian wrote:
>
> Your patch has been added to the PostgreSQL unapplied patches list at:
>
> http://momjian.postgresql.org/cgi-bin/pgpatches
>
> It will be applied as soon as one of the PostgreSQL committers reviews
> and approves it.

Please put this on hold until we decide what to do with Heikki's patch
to update OldestXmin during vacuum.

One idea is to count the tuples actually cleared during vacuum. Another
idea is to reread pgstat data after each OldestXmin recalculation to get
accurate dead tuple counting. Neither of these seem very satisfying.

> ---------------------------------------------------------------------------
>
> ITAGAKI Takahiro wrote:
> > Here is a patch discussed in
> > http://archives.postgresql.org/pgsql-hackers/2007-02/msg00010.php
> >
> > Concurrent vacuum will save n_dead_tuples value at the beginning.
> > Stats collector will be subtract the value from n_dead_tuples
> > instead of setting it to zero. The statistics accuracy of n_dead_tuples
> > will be better, especially just after finish of a vacuum.
> >
> > The behavior in VACUUM FULL is not changed because concurrent updates
> > are not allowed during VACUUM FULL.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Error correction for n_dead_tuples
Date: 2007-02-20 01:42:53
Message-ID: 200702200142.l1K1gri11542@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Alvaro Herrera wrote:
> Bruce Momjian wrote:
> >
> > Your patch has been added to the PostgreSQL unapplied patches list at:
> >
> > http://momjian.postgresql.org/cgi-bin/pgpatches
> >
> > It will be applied as soon as one of the PostgreSQL committers reviews
> > and approves it.
>
> Please put this on hold until we decide what to do with Heikki's patch
> to update OldestXmin during vacuum.
>
> One idea is to count the tuples actually cleared during vacuum. Another
> idea is to reread pgstat data after each OldestXmin recalculation to get
> accurate dead tuple counting. Neither of these seem very satisfying.

OK.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: alvherre(at)commandprompt(dot)com
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Error correction for n_dead_tuples
Date: 2007-02-20 02:03:33
Message-ID: 20070220104402.5E49.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:

> Please put this on hold until we decide what to do with Heikki's patch
> to update OldestXmin during vacuum.

Yes, I think his patch is very useful, but it has a little conflict
with my patch.

> One idea is to count the tuples actually cleared during vacuum. Another
> idea is to reread pgstat data after each OldestXmin recalculation to get
> accurate dead tuple counting. Neither of these seem very satisfying.

I'm thinking to use the larger value of follows:
- dead tuples statistic count at the beginning of vacuum
- count the tuples actually cleared during vacuum

The latter is usually larger with Heikki's patch. In the other hand,
the formar is larger in only cases when many DELETEs were rollbacked.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Error correction for n_dead_tuples
Date: 2007-09-26 08:23:20
Message-ID: 200709260823.l8Q8NKa05660@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


This patch is no longer needed. We can revisit this during 8.4 to see
if it is still needed now that we have HOT.

---------------------------------------------------------------------------

ITAGAKI Takahiro wrote:
> Here is a patch discussed in
> http://archives.postgresql.org/pgsql-hackers/2007-02/msg00010.php
>
> Concurrent vacuum will save n_dead_tuples value at the beginning.
> Stats collector will be subtract the value from n_dead_tuples
> instead of setting it to zero. The statistics accuracy of n_dead_tuples
> will be better, especially just after finish of a vacuum.
>
> The behavior in VACUUM FULL is not changed because concurrent updates
> are not allowed during VACUUM FULL.
>
> Comments welcome.
>
> Regards,
> ---
> ITAGAKI Takahiro
> NTT Open Source Software Center

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +