New pg_dump patch -- document statistics collector exception

Started by Bryce Nesbittalmost 17 years ago13 messages
#1Bryce Nesbitt
bryce2@obviously.com
1 attachment(s)

This is a proposed patch to document disabling the statistics collector
pg_dump activity, and give a bit more visibility to the PGOPTIONS
environment variable supported by libpq.

It is an alternative to the prior patch, which supplied a --no-stats flag.

This is a documentation only patch, not tied to a recent code change.

Attachments:

pgdump_man.patchtext/x-diff; name=pgdump_man.patchDownload
? HTML.index
? test.man
Index: ref/pg_dump.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v
retrieving revision 1.106
diff -c -2 -r1.106 pg_dump.sgml
*** ref/pg_dump.sgml	5 Jan 2009 16:54:36 -0000	1.106
--- ref/pg_dump.sgml	21 Jan 2009 01:15:41 -0000
***************
*** 727,733 ****
      <term><envar>PGDATABASE</envar></term>
      <term><envar>PGHOST</envar></term>
      <term><envar>PGPORT</envar></term>
-     <term><envar>PGUSER</envar></term>
  
      <listitem>
       <para>
--- 727,734 ----
      <term><envar>PGDATABASE</envar></term>
      <term><envar>PGHOST</envar></term>
+     <term><envar>PGOPTIONS</envar></term>
      <term><envar>PGPORT</envar></term>
  
+     <term><envar>PGUSER</envar></term>
      <listitem>
       <para>
***************
*** 735,738 ****
--- 736,740 ----
       </para>
      </listitem>
+ 
     </varlistentry>
    </variablelist>
***************
*** 758,761 ****
--- 760,770 ----
     library will apply.
    </para>
+   <para>
+    The database activity of <application>pg_dump</application> is normally collected by the statistics collector.
+    If this is undesirable, you can set parameters <literal>stats_block_level</literal> and <literal>stats_row_level</literal> to false
+    via the <application>libpq</> <envar>PGOPTIONS</envar> environment varriable, or via <literal>ALTER USER</literal>.
+   </para>
+ 
+ 
   </refsect1>
  
Index: ref/pg_dumpall.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v
retrieving revision 1.74
diff -c -2 -r1.74 pg_dumpall.sgml
*** ref/pg_dumpall.sgml	5 Jan 2009 16:54:36 -0000	1.74
--- ref/pg_dumpall.sgml	21 Jan 2009 01:15:41 -0000
***************
*** 446,449 ****
--- 446,450 ----
     <varlistentry>
      <term><envar>PGHOST</envar></term>
+     <term><envar>PGOPTIONS</envar></term>
      <term><envar>PGPORT</envar></term>
      <term><envar>PGUSER</envar></term>
Index: ref/pg_restore.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/pg_restore.sgml,v
retrieving revision 1.77
diff -c -2 -r1.77 pg_restore.sgml
*** ref/pg_restore.sgml	5 Jan 2009 16:54:36 -0000	1.77
--- ref/pg_restore.sgml	21 Jan 2009 01:15:41 -0000
***************
*** 538,541 ****
--- 538,542 ----
     <varlistentry>
      <term><envar>PGHOST</envar></term>
+     <term><envar>PGOPTIONS</envar></term>
      <term><envar>PGPORT</envar></term>
      <term><envar>PGUSER</envar></term>
#2Robert Treat
xzilla@users.sourceforge.net
In reply to: Bryce Nesbitt (#1)
Re: New pg_dump patch -- document statistics collector exception

On Tuesday 20 January 2009 20:22:10 Bryce Nesbitt wrote:

This is a proposed patch to document disabling the statistics collector
pg_dump activity, and give a bit more visibility to the PGOPTIONS
environment variable supported by libpq.

It is an alternative to the prior patch, which supplied a --no-stats flag.

This is a documentation only patch, not tied to a recent code change.

s/varriable/variable/g

also, I forget which way is proper, but you're inconsistent with your closing
tags for <application> in that paragraph (using both </application and </>)

--
Robert Treat
Conjecture: http://www.xzilla.net
Consulting: http://www.omniti.com

#3Alvaro Herrera
alvherre@commandprompt.com
In reply to: Robert Treat (#2)
Re: New pg_dump patch -- document statistics collector exception

Robert Treat wrote:

also, I forget which way is proper, but you're inconsistent with your closing
tags for <application> in that paragraph (using both </application and </>)

They're both acceptable.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#4Bryce Nesbitt
bryce2@obviously.com
In reply to: Alvaro Herrera (#3)
1 attachment(s)
Re: New pg_dump patch -- document statistics collector exception (REVISED PATCH)

Here's a revision (thanks Robert Treat for the spelling corrextion).
If there are no other objections, how do I nominate it for consideration?
-Bryce

Attachments:

pgsl_doc_src_sgml.patchtext/x-diff; name=pgsl_doc_src_sgml.patchDownload
Index: pg_dump.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v
retrieving revision 1.106
diff -c -2 -r1.106 pg_dump.sgml
*** pg_dump.sgml	5 Jan 2009 16:54:36 -0000	1.106
--- pg_dump.sgml	23 Jan 2009 20:57:36 -0000
***************
*** 727,733 ****
      <term><envar>PGDATABASE</envar></term>
      <term><envar>PGHOST</envar></term>
      <term><envar>PGPORT</envar></term>
-     <term><envar>PGUSER</envar></term>
  
      <listitem>
       <para>
--- 727,734 ----
      <term><envar>PGDATABASE</envar></term>
      <term><envar>PGHOST</envar></term>
+     <term><envar>PGOPTIONS</envar></term>
      <term><envar>PGPORT</envar></term>
  
+     <term><envar>PGUSER</envar></term>
      <listitem>
       <para>
***************
*** 735,738 ****
--- 736,740 ----
       </para>
      </listitem>
+ 
     </varlistentry>
    </variablelist>
***************
*** 758,761 ****
--- 760,772 ----
     library will apply.
    </para>
+   <para>
+    The database activity of <application>pg_dump</application> is normally collected by the
+    statistics collector.  If this is undesirable, you can set parameters
+    <literal>stats_block_level</literal> and <literal>stats_row_level</literal> to false
+    via the <application>libpq</application> <envar>PGOPTIONS</envar> environment variable,
+    or via <literal>ALTER USER</literal>.
+   </para>
+ 
+ 
   </refsect1>
  
Index: pg_dumpall.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v
retrieving revision 1.74
diff -c -2 -r1.74 pg_dumpall.sgml
*** pg_dumpall.sgml	5 Jan 2009 16:54:36 -0000	1.74
--- pg_dumpall.sgml	23 Jan 2009 20:57:36 -0000
***************
*** 446,449 ****
--- 446,450 ----
     <varlistentry>
      <term><envar>PGHOST</envar></term>
+     <term><envar>PGOPTIONS</envar></term>
      <term><envar>PGPORT</envar></term>
      <term><envar>PGUSER</envar></term>
Index: pg_restore.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/pg_restore.sgml,v
retrieving revision 1.77
diff -c -2 -r1.77 pg_restore.sgml
*** pg_restore.sgml	5 Jan 2009 16:54:36 -0000	1.77
--- pg_restore.sgml	23 Jan 2009 20:57:36 -0000
***************
*** 538,541 ****
--- 538,542 ----
     <varlistentry>
      <term><envar>PGHOST</envar></term>
+     <term><envar>PGOPTIONS</envar></term>
      <term><envar>PGPORT</envar></term>
      <term><envar>PGUSER</envar></term>
#5Josh Berkus
josh@agliodbs.com
In reply to: Bryce Nesbitt (#4)
Re: New pg_dump patch -- document statistics collector exception (REVISED PATCH)

Bryce Nesbitt wrote:

Here's a revision (thanks Robert Treat for the spelling corrextion).
If there are no other objections, how do I nominate it for consideration?
-Bryce

You already have.

Mind you, in the future when you're not continuing a discussion from a
code patch, you should submit doc patches to pgsql-docs. But I'm sure
Peter has seen it here.

--Josh

In reply to: Bryce Nesbitt (#4)
Re: New pg_dump patch -- document statistics collector exception (REVISED PATCH)

Bryce Nesbitt escreveu:

Here's a revision (thanks Robert Treat for the spelling corrextion).
If there are no other objections, how do I nominate it for consideration?

Added to next commit fest [1]http://wiki.postgresql.org/wiki/CommitFest_2009-First.

[1]: http://wiki.postgresql.org/wiki/CommitFest_2009-First

--
Euler Taveira de Oliveira
http://www.timbira.com/

#7Josh Berkus
josh@agliodbs.com
In reply to: Euler Taveira de Oliveira (#6)
Re: New pg_dump patch -- document statistics collector exception (REVISED PATCH)

Euler Taveira de Oliveira wrote:

Bryce Nesbitt escreveu:

Here's a revision (thanks Robert Treat for the spelling corrextion).
If there are no other objections, how do I nominate it for consideration?

Added to next commit fest [1].

Um, not necessary. We're still accepting new doc patches, and will
until the end of beta.

--Josh

#8Bruce Momjian
bruce@momjian.us
In reply to: Bryce Nesbitt (#1)
Re: New pg_dump patch -- document statistics collector exception

Bryce Nesbitt wrote:

This is a proposed patch to document disabling the statistics collector
pg_dump activity, and give a bit more visibility to the PGOPTIONS
environment variable supported by libpq.

It is an alternative to the prior patch, which supplied a --no-stats flag.

This is a documentation only patch, not tied to a recent code change.

Patch applied, with spelling correction already noted.

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

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

#9Bruce Momjian
bruce@momjian.us
In reply to: Josh Berkus (#7)
Re: New pg_dump patch -- document statistics collector exception (REVISED PATCH)

Josh Berkus wrote:

Euler Taveira de Oliveira wrote:

Bryce Nesbitt escreveu:

Here's a revision (thanks Robert Treat for the spelling corrextion).
If there are no other objections, how do I nominate it for consideration?

Added to next commit fest [1].

Um, not necessary. We're still accepting new doc patches, and will
until the end of beta.

Yep, patch commited, removed from next commit fest.

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

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

#10Bryce Nesbitt
bryce2@obviously.com
In reply to: Bruce Momjian (#8)
1 attachment(s)
Re: New pg_dump patch -- document statistics collector exception

Attachments:

pg_dump.patchtext/x-diff; name=pg_dump.patchDownload
Index: pg_dump.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.514
diff -c -2 -r1.514 pg_dump.c
*** pg_dump.c	18 Jan 2009 20:44:45 -0000	1.514
--- pg_dump.c	20 Jan 2009 20:47:25 -0000
***************
*** 236,239 ****
--- 236,240 ----
  	static int  outputNoTablespaces = 0;
  	static int	use_setsessauth = 0;
+ 	static int  noStatsCollection = 0;
  
  	static struct option long_options[] = {
***************
*** 278,281 ****
--- 279,283 ----
  		{"role", required_argument, NULL, 3},
  		{"use-set-session-authorization", no_argument, &use_setsessauth, 1},
+ 		{"no-stats", no_argument, &noStatsCollection, 1},
  
  		{NULL, 0, NULL, 0}
***************
*** 430,433 ****
--- 432,437 ----
  				else if (strcmp(optarg, "no-tablespaces") == 0)
  					outputNoTablespaces = 1;
+ 				else if (strcmp(optarg, "no-stats") == 0)
+ 					noStatsCollection = 1;
  				else if (strcmp(optarg, "use-set-session-authorization") == 0)
  					use_setsessauth = 1;
***************
*** 613,616 ****
--- 617,629 ----
  		do_sql_command(g_conn, "SET statement_timeout = 0");
  
+	/* 
+	 * Disable collection of statistics.  pg_dump's activity may be very different
+	 * from what you are trying to analyze in the stats tables.
+	 */
+ 	if( noStatsCollection ) {
+ 		do_sql_command(g_conn, "SET stats_block_level = false");
+ 		do_sql_command(g_conn, "SET stats_row_level   = false");
+ 	}
+ 
  	/*
  	 * Start serializable transaction to dump consistent data.
***************
*** 833,836 ****
--- 846,850 ----
  	printf(_("  -U, --username=NAME      connect as specified database user\n"));
  	printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
+ 	printf(_("  --no-stats               disable statistics collection (superuser only)\n"));
  
  	printf(_("\nIf no database name is supplied, then the PGDATABASE environment\n"
#11Bruce Momjian
bruce@momjian.us
In reply to: Bryce Nesbitt (#10)
Re: New pg_dump patch -- document statistics collector exception

Apologies. Turns out the name of the relevant setting was changed
for 8.3! So a revised patch is attached.
For backing, see:
http://www.postgresql.org/docs/8.3/static/release-8-3.html
" Numerous changes in administrative server parameters...
stats_block_level and stats_row_level are merged into track_counts."
Bryce Nesbitt wrote:

We don't want a pg_dump flag; the doc mention is good enough.

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

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

#12Bryce Nesbitt
bryce2@obviously.com
In reply to: Bruce Momjian (#11)
1 attachment(s)
Re: New pg_dump patch -- document statistics collector exception

Attachments:

pg_doc_patch.patchtext/x-diff; name=pg_doc_patch.patchDownload
Index: ref/pg_dump.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v
retrieving revision 1.108
diff -c -2 -r1.108 pg_dump.sgml
*** ref/pg_dump.sgml	7 Feb 2009 15:25:51 -0000	1.108
--- ref/pg_dump.sgml	9 Feb 2009 20:19:48 -0000
***************
*** 760,773 ****
     library will apply.
    </para>
    <para>
!    The database activity of <application>pg_dump</application> is
!    normally collected by the statistics collector.  If this is
!    undesirable, you can set parameters <literal>stats_block_level</literal>
!    and <literal>stats_row_level</literal> to false via the
!    <application>libpq</> <envar>PGOPTIONS</envar> environment variable,
!    or via <literal>ALTER USER</literal>.
    </para>
  
- 
   </refsect1>
  
--- 760,772 ----
     library will apply.
    </para>
+ 
    <para>
!    The database activity of <application>pg_dump</application> is normally collected by the
!    statistics collector.  If this is undesirable, you can set parameter
!    <literal>track_counts</literal> to false via <envar>PGOPTIONS</envar>
!    or the <literal>ALTER USER</literal> command. For versions prior to 8.3, set
!    <literal>stats_block_level</literal> and <literal>stats_row_level</literal> instead.
    </para>
  
   </refsect1>
  
#13Bruce Momjian
bruce@momjian.us
In reply to: Bryce Nesbitt (#12)
Re: New pg_dump patch -- document statistics collector exception

We don't want a pg_dump flag; the doc mention is good enough.

Doh! Try this one instead. Postgres 8.3 changed the name of the
flag mentioned in the doc.

[ Please avoid html-only email.]

OK, patch applied, but I removed the mention of pre-8.3 because this is
going only in the 8.4 docs.

Thanks.

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

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