pg.ddx.io  pgsql-patches@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bryce Nesbitt <bryce2@obviously.com>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>
Subject: New pg_dump patch, --no-stats flag, disables sending to statistics collector
Date: Tue, 20 Jan 2009 13:04:07 -0800
Message-ID: <49763C47.7070400@obviously.com> (raw)
In-Reply-To: <1232474489.23316.8.camel@jdavis>
References: <483FD205.4090904@sigaev.ru>
	<486BC501.6060605@sigaev.ru>
	<27880.1215810535@sss.pgh.pa.us>
	<487A6E0C.3090600@sigaev.ru>
	<8993.1216843701@sss.pgh.pa.us>
	<4888A594.6010102@sigaev.ru>
	<490B07BA.6030109@sigaev.ru>
	<492F04D9.5070404@enterprisedb.com>
	<4942A137.3000502@sigaev.ru>
	<1229910966.2285.76.camel@jdavis>
	<49708008.8070109@sigaev.ru>
	<1232348905.7281.114.camel@jdavis>
	<4974B002.3040202@sigaev.ru>
	<1232474489.23316.8.camel@jdavis>

This patch adds another flag to pg_dump, this time to disable statistics 
collection.  This is useful if your don't want pg_dump activity to show 
(or clutter) your normal statistics.  This may be appropriate for an 
organization that regularly dumps a database for backup purposes, but 
wants to analyze only the application's database use.

This is patched against CVS HEAD from today, though the code is quite 
version independent.  This patch is unsolicited, and as far as I know 
has not been discussed on the list prior to now.

Comments?

Attachments:

pg_dump.patch (text/x-diff, 1.9K) download 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"

view thread (9+ messages)  latest in thread

Message-ID: <49763C47.7070400@obviously.com>
Permalink:  ../49763C47.7070400@obviously.com/
Also on:    postgresql.org/message-id/49763C47.7070400@obviously.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-patches@postgresql.org
  Cc: bryce2@obviously.com, pgsql-hackers@postgresql.org
  Subject: Re: New pg_dump patch, --no-stats flag, disables sending to statistics collector
  In-Reply-To: <49763C47.7070400@obviously.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox