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"