Thread: docfix - DELETE doesn't affect auto-analyze

docfix - DELETE doesn't affect auto-analyze

From
ITAGAKI Takahiro
Date:
I reported an incorrect description for auto-analyze in our documentation.
http://archives.postgresql.org/pgsql-hackers/2007-06/msg00000.php
Here is a documentation fix for it.

There are the same mistakes in 8.1 and 8.2, not only in HEAD.
It had been true in contrib/pg_autovacuum at 8.0, but we
changed the behavior at the integration of autovacuum.


Index: doc/src/sgml/maintenance.sgml
===================================================================
--- doc/src/sgml/maintenance.sgml    (HEAD)
+++ doc/src/sgml/maintenance.sgml    (fixed)
@@ -533,7 +533,7 @@
 <programlisting>
 analyze threshold = analyze base threshold + analyze scale factor * number of tuples
 </programlisting>
-    is compared to the total number of tuples inserted, updated, or deleted
+    is compared to the total number of tuples inserted or updated
     since the last <command>ANALYZE</command>.
    </para>


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


Re: docfix - DELETE doesn't affect auto-analyze

From
Bruce Momjian
Date:
Patch applied.  Thanks.  Your documentation changes can be viewed in
five minutes using links on the developer's page,
http://www.postgresql.org/developer/testing.


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


ITAGAKI Takahiro wrote:
> I reported an incorrect description for auto-analyze in our documentation.
> http://archives.postgresql.org/pgsql-hackers/2007-06/msg00000.php
> Here is a documentation fix for it.
>
> There are the same mistakes in 8.1 and 8.2, not only in HEAD.
> It had been true in contrib/pg_autovacuum at 8.0, but we
> changed the behavior at the integration of autovacuum.
>
>
> Index: doc/src/sgml/maintenance.sgml
> ===================================================================
> --- doc/src/sgml/maintenance.sgml    (HEAD)
> +++ doc/src/sgml/maintenance.sgml    (fixed)
> @@ -533,7 +533,7 @@
>  <programlisting>
>  analyze threshold = analyze base threshold + analyze scale factor * number of tuples
>  </programlisting>
> -    is compared to the total number of tuples inserted, updated, or deleted
> +    is compared to the total number of tuples inserted or updated
>      since the last <command>ANALYZE</command>.
>     </para>
>
>
> Regards,
> ---
> ITAGAKI Takahiro
> NTT Open Source Software Center
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq

--
  Bruce Momjian  <bruce@momjian.us>          http://momjian.us
  EnterpriseDB                               http://www.enterprisedb.com

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

Re: docfix - DELETE doesn't affect auto-analyze

From
Tom Lane
Date:
Bruce Momjian <bruce@momjian.us> writes:
>> -    is compared to the total number of tuples inserted, updated, or deleted
>> +    is compared to the total number of tuples inserted or updated

As best I can tell, this description is even further away from the
actual CVS HEAD behavior than the previous one.  The code is comparing
against

        anltuples = tabentry->n_live_tuples + tabentry->n_dead_tuples -
            tabentry->last_anl_tuples;

and deletions surely increase n_dead_tuples.

            regards, tom lane

Re: docfix - DELETE doesn't affect auto-analyze

From
ITAGAKI Takahiro
Date:
Bruce Momjian <bruce@momjian.us> wrote:

> Patch applied.  Thanks.  Your documentation changes can be viewed in
> five minutes using links on the developer's page,
> http://www.postgresql.org/developer/testing.

Thanks. Don't we need to backport it to 8.1 and 8.2?
It was changed at the integration of autovacuum at 8.1.


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



Re: docfix - DELETE doesn't affect auto-analyze

From
Alvaro Herrera
Date:
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> >> -    is compared to the total number of tuples inserted, updated, or deleted
> >> +    is compared to the total number of tuples inserted or updated
>
> As best I can tell, this description is even further away from the
> actual CVS HEAD behavior than the previous one.  The code is comparing
> against
>
>         anltuples = tabentry->n_live_tuples + tabentry->n_dead_tuples -
>             tabentry->last_anl_tuples;
>
> and deletions surely increase n_dead_tuples.

I think the patch is correct for 8.1 and 8.2 but is wrong for HEAD
(disclaimer: I'm a bit sleepy ATM).

--
Alvaro Herrera                        http://www.advogato.org/person/alvherre
Management by consensus: I have decided; you concede.
(Leonard Liu)

Re: docfix - DELETE doesn't affect auto-analyze

From
ITAGAKI Takahiro
Date:
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Bruce Momjian <bruce@momjian.us> writes:
> >> -    is compared to the total number of tuples inserted, updated, or deleted
> >> +    is compared to the total number of tuples inserted or updated
>
> As best I can tell, this description is even further away from the
> actual CVS HEAD behavior than the previous one.  The code is comparing
> against
>
>         anltuples = tabentry->n_live_tuples + tabentry->n_dead_tuples -
>             tabentry->last_anl_tuples;
>
> and deletions surely increase n_dead_tuples.

Yes, but they also decrease n_live_tuples;
anltuples is not affected by deletions.

if (isCommit)
{
    tabstat->t_counts.t_new_live_tuples +=
        trans->tuples_inserted - trans->tuples_deleted;
    tabstat->t_counts.t_new_dead_tuples += trans->tuples_deleted;
}

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



Re: docfix - DELETE doesn't affect auto-analyze

From
Bruce Momjian
Date:
ITAGAKI Takahiro wrote:
>
> Bruce Momjian <bruce@momjian.us> wrote:
>
> > Patch applied.  Thanks.  Your documentation changes can be viewed in
> > five minutes using links on the developer's page,
> > http://www.postgresql.org/developer/testing.
>
> Thanks. Don't we need to backport it to 8.1 and 8.2?
> It was changed at the integration of autovacuum at 8.1.

I don't worry about documentation details at that level for non-HEAD
releases.

--
  Bruce Momjian  <bruce@momjian.us>          http://momjian.us
  EnterpriseDB                               http://www.enterprisedb.com

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