docfix - DELETE doesn't affect auto-analyze

Started by ITAGAKI Takahiroabout 19 years ago7 messagespatches
Jump to latest
#1ITAGAKI Takahiro
itagaki.takahiro@oss.ntt.co.jp

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

#2Bruce Momjian
bruce@momjian.us
In reply to: ITAGAKI Takahiro (#1)
Re: docfix - DELETE doesn't affect auto-analyze

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. +

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#2)
Re: docfix - DELETE doesn't affect auto-analyze

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

#4ITAGAKI Takahiro
itagaki.takahiro@oss.ntt.co.jp
In reply to: Bruce Momjian (#2)
Re: docfix - DELETE doesn't affect auto-analyze

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

#5Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#3)
Re: docfix - DELETE doesn't affect auto-analyze

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)

#6ITAGAKI Takahiro
itagaki.takahiro@oss.ntt.co.jp
In reply to: Tom Lane (#3)
Re: docfix - DELETE doesn't affect auto-analyze

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

#7Bruce Momjian
bruce@momjian.us
In reply to: ITAGAKI Takahiro (#4)
Re: docfix - DELETE doesn't affect auto-analyze

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. +