aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/analyze.c12
-rw-r--r--src/backend/commands/vacuumlazy.c10
-rw-r--r--src/backend/postmaster/autovacuum.c28
-rw-r--r--src/backend/postmaster/pgstat.c94
-rw-r--r--src/backend/utils/misc/guc.c62
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample19
-rw-r--r--src/include/pgstat.h65
-rw-r--r--src/include/postmaster/autovacuum.h4
-rw-r--r--src/test/regress/expected/stats.out9
-rw-r--r--src/test/regress/sql/stats.sql6
10 files changed, 108 insertions, 201 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index d77aec2dd74..418dbaa1084 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.108 2007/05/30 20:11:56 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.109 2007/09/24 03:12:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -202,10 +202,10 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
}
/* measure elapsed time iff autovacuum logging requires it */
- if (IsAutoVacuumWorkerProcess() && Log_autovacuum >= 0)
+ if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration >= 0)
{
pg_rusage_init(&ru0);
- if (Log_autovacuum > 0)
+ if (Log_autovacuum_min_duration > 0)
starttime = GetCurrentTimestamp();
}
@@ -472,11 +472,11 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
relation_close(onerel, NoLock);
/* Log the action if appropriate */
- if (IsAutoVacuumWorkerProcess() && Log_autovacuum >= 0)
+ if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration >= 0)
{
- if (Log_autovacuum == 0 ||
+ if (Log_autovacuum_min_duration == 0 ||
TimestampDifferenceExceeds(starttime, GetCurrentTimestamp(),
- Log_autovacuum))
+ Log_autovacuum_min_duration))
ereport(LOG,
(errmsg("automatic analyze of table \"%s.%s.%s\" system usage: %s",
get_database_name(MyDatabaseId),
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 564ab8d9fdd..df8951ee1e7 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -36,7 +36,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.98 2007/09/20 21:43:27 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.99 2007/09/24 03:12:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -154,7 +154,7 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
pg_rusage_init(&ru0);
/* measure elapsed time iff autovacuum logging requires it */
- if (IsAutoVacuumWorkerProcess() && Log_autovacuum > 0)
+ if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration > 0)
starttime = GetCurrentTimestamp();
if (vacstmt->verbose)
@@ -221,11 +221,11 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
vacstmt->analyze, vacrelstats->rel_tuples);
/* and log the action if appropriate */
- if (IsAutoVacuumWorkerProcess() && Log_autovacuum >= 0)
+ if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration >= 0)
{
- if (Log_autovacuum == 0 ||
+ if (Log_autovacuum_min_duration == 0 ||
TimestampDifferenceExceeds(starttime, GetCurrentTimestamp(),
- Log_autovacuum))
+ Log_autovacuum_min_duration))
ereport(LOG,
(errmsg("automatic vacuum of table \"%s.%s.%s\": index scans: %d\n"
"pages: %d removed, %d remain\n"
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 8866f287ca1..7c9b7f72b6c 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -55,7 +55,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.59 2007/09/23 20:07:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.60 2007/09/24 03:12:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -114,7 +114,7 @@ int autovacuum_freeze_max_age;
int autovacuum_vac_cost_delay;
int autovacuum_vac_cost_limit;
-int Log_autovacuum = -1;
+int Log_autovacuum_min_duration = -1;
/* Flags to tell if we are in an autovacuum process */
@@ -511,7 +511,7 @@ AutoVacLauncherMain(int argc, char *argv[])
PG_SETMASK(&UnBlockSig);
/* in emergency mode, just start a worker and go away */
- if (!autovacuum_start_daemon)
+ if (!AutoVacuumingActive())
{
do_start_worker();
proc_exit(0); /* done */
@@ -590,7 +590,7 @@ AutoVacLauncherMain(int argc, char *argv[])
ProcessConfigFile(PGC_SIGHUP);
/* shutdown requested in config file */
- if (!autovacuum_start_daemon)
+ if (!AutoVacuumingActive())
break;
/* rebalance in case the default cost parameters changed */
@@ -2625,8 +2625,7 @@ autovac_report_activity(VacuumStmt *vacstmt, Oid relid)
bool
AutoVacuumingActive(void)
{
- if (!autovacuum_start_daemon || !pgstat_collect_startcollector ||
- !pgstat_collect_tuplelevel)
+ if (!autovacuum_start_daemon || !pgstat_track_counts)
return false;
return true;
}
@@ -2635,26 +2634,15 @@ AutoVacuumingActive(void)
* autovac_init
* This is called at postmaster initialization.
*
- * Annoy the user if he got it wrong.
+ * All we do here is annoy the user if he got it wrong.
*/
void
autovac_init(void)
{
- if (!autovacuum_start_daemon)
- return;
-
- if (!pgstat_collect_startcollector || !pgstat_collect_tuplelevel)
- {
+ if (autovacuum_start_daemon && !pgstat_track_counts)
ereport(WARNING,
(errmsg("autovacuum not started because of misconfiguration"),
- errhint("Enable options \"stats_start_collector\" and \"stats_row_level\".")));
-
- /*
- * Set the GUC var so we don't fork autovacuum uselessly, and also to
- * help debugging.
- */
- autovacuum_start_daemon = false;
- }
+ errhint("Enable the \"track_counts\" option.")));
}
/*
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index 9e088780d4c..20ae5be6c99 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2007, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.164 2007/09/20 17:56:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.165 2007/09/24 03:12:23 tgl Exp $
* ----------
*/
#include "postgres.h"
@@ -55,6 +55,7 @@
#include "storage/ipc.h"
#include "storage/pg_shmem.h"
#include "storage/pmsignal.h"
+#include "utils/guc.h"
#include "utils/memutils.h"
#include "utils/ps_status.h"
@@ -93,11 +94,8 @@
* GUC parameters
* ----------
*/
-bool pgstat_collect_startcollector = true;
-bool pgstat_collect_resetonpmstart = false;
-bool pgstat_collect_tuplelevel = false;
-bool pgstat_collect_blocklevel = false;
-bool pgstat_collect_querystring = false;
+bool pgstat_track_activities = false;
+bool pgstat_track_counts = false;
/*
* BgWriter global statistics counters (unused in other processes).
@@ -257,28 +255,6 @@ pgstat_init(void)
#define TESTBYTEVAL ((char) 199)
/*
- * Force start of collector daemon if something to collect. Note that
- * pgstat_collect_querystring is now an independent facility that does not
- * require the collector daemon.
- */
- if (pgstat_collect_tuplelevel ||
- pgstat_collect_blocklevel)
- pgstat_collect_startcollector = true;
-
- /*
- * If we don't have to start a collector or should reset the collected
- * statistics on postmaster start, simply remove the stats file.
- */
- if (!pgstat_collect_startcollector || pgstat_collect_resetonpmstart)
- pgstat_reset_all();
-
- /*
- * Nothing else required if collector will not get started
- */
- if (!pgstat_collect_startcollector)
- return;
-
- /*
* Create the UDP socket for sending and receiving statistic messages
*/
hints.ai_flags = AI_PASSIVE;
@@ -492,17 +468,19 @@ startup_failed:
closesocket(pgStatSock);
pgStatSock = -1;
- /* Adjust GUC variables to suppress useless activity */
- pgstat_collect_startcollector = false;
- pgstat_collect_tuplelevel = false;
- pgstat_collect_blocklevel = false;
+ /*
+ * Adjust GUC variables to suppress useless activity, and for debugging
+ * purposes (seeing track_counts off is a clue that we failed here).
+ * We use PGC_S_OVERRIDE because there is no point in trying to turn it
+ * back on from postgresql.conf without a restart.
+ */
+ SetConfigOption("track_counts", "off", PGC_INTERNAL, PGC_S_OVERRIDE);
}
/*
* pgstat_reset_all() -
*
- * Remove the stats file. This is used on server start if the
- * stats_reset_on_server_start feature is enabled, or if WAL
+ * Remove the stats file. This is currently used only if WAL
* recovery is needed after a crash.
*/
void
@@ -536,7 +514,7 @@ pgstat_forkexec(void)
#endif /* EXEC_BACKEND */
-/* ----------
+/*
* pgstat_start() -
*
* Called from postmaster at startup or after an existing collector
@@ -545,7 +523,6 @@ pgstat_forkexec(void)
* Returns PID of child process, or 0 if fail.
*
* Note: if fail, we will be called again from the postmaster main loop.
- * ----------
*/
int
pgstat_start(void)
@@ -554,9 +531,10 @@ pgstat_start(void)
pid_t pgStatPid;
/*
- * Do nothing if no collector needed
+ * Check that the socket is there, else pgstat_init failed and we can
+ * do nothing useful.
*/
- if (!pgstat_collect_startcollector)
+ if (pgStatSock < 0)
return 0;
/*
@@ -572,22 +550,6 @@ pgstat_start(void)
last_pgstat_start_time = curtime;
/*
- * Check that the socket is there, else pgstat_init failed.
- */
- if (pgStatSock < 0)
- {
- ereport(LOG,
- (errmsg("statistics collector startup skipped")));
-
- /*
- * We can only get here if someone tries to manually turn
- * pgstat_collect_startcollector on after it had been off.
- */
- pgstat_collect_startcollector = false;
- return 0;
- }
-
- /*
* Okay, fork off the collector.
*/
#ifdef EXEC_BACKEND
@@ -1052,8 +1014,7 @@ pgstat_report_vacuum(Oid tableoid, bool shared,
{
PgStat_MsgVacuum msg;
- if (pgStatSock < 0 ||
- !pgstat_collect_tuplelevel)
+ if (pgStatSock < 0 || !pgstat_track_counts)
return;
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_VACUUM);
@@ -1078,8 +1039,7 @@ pgstat_report_analyze(Oid tableoid, bool shared, PgStat_Counter livetuples,
{
PgStat_MsgAnalyze msg;
- if (pgStatSock < 0 ||
- !pgstat_collect_tuplelevel)
+ if (pgStatSock < 0 || !pgstat_track_counts)
return;
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_ANALYZE);
@@ -1139,9 +1099,7 @@ pgstat_initstats(Relation rel)
return;
}
- if (pgStatSock < 0 ||
- !(pgstat_collect_tuplelevel ||
- pgstat_collect_blocklevel))
+ if (pgStatSock < 0 || !pgstat_track_counts)
{
/* We're not counting at all */
rel->pgstat_info = NULL;
@@ -1274,7 +1232,7 @@ pgstat_count_heap_insert(Relation rel)
{
PgStat_TableStatus *pgstat_info = rel->pgstat_info;
- if (pgstat_collect_tuplelevel && pgstat_info != NULL)
+ if (pgstat_track_counts && pgstat_info != NULL)
{
int nest_level = GetCurrentTransactionNestLevel();
@@ -1298,7 +1256,7 @@ pgstat_count_heap_update(Relation rel, bool hot)
{
PgStat_TableStatus *pgstat_info = rel->pgstat_info;
- if (pgstat_collect_tuplelevel && pgstat_info != NULL)
+ if (pgstat_track_counts && pgstat_info != NULL)
{
int nest_level = GetCurrentTransactionNestLevel();
@@ -1327,7 +1285,7 @@ pgstat_count_heap_delete(Relation rel)
{
PgStat_TableStatus *pgstat_info = rel->pgstat_info;
- if (pgstat_collect_tuplelevel && pgstat_info != NULL)
+ if (pgstat_track_counts && pgstat_info != NULL)
{
int nest_level = GetCurrentTransactionNestLevel();
@@ -1356,7 +1314,7 @@ pgstat_update_heap_dead_tuples(Relation rel, int delta)
{
PgStat_TableStatus *pgstat_info = rel->pgstat_info;
- if (pgstat_collect_tuplelevel && pgstat_info != NULL)
+ if (pgstat_track_counts && pgstat_info != NULL)
pgstat_info->t_counts.t_new_dead_tuples -= delta;
}
@@ -1931,7 +1889,7 @@ pgstat_report_activity(const char *cmd_str)
TimestampTz start_timestamp;
int len;
- if (!pgstat_collect_querystring || !beentry)
+ if (!pgstat_track_activities || !beentry)
return;
/*
@@ -1967,7 +1925,7 @@ pgstat_report_xact_timestamp(TimestampTz tstamp)
{
volatile PgBackendStatus *beentry = MyBEEntry;
- if (!pgstat_collect_querystring || !beentry)
+ if (!pgstat_track_activities || !beentry)
return;
/*
@@ -1995,7 +1953,7 @@ pgstat_report_waiting(bool waiting)
{
volatile PgBackendStatus *beentry = MyBEEntry;
- if (!pgstat_collect_querystring || !beentry)
+ if (!pgstat_track_activities || !beentry)
return;
/*
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 371bc0b000f..027d1b25e5f 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.420 2007/09/11 00:06:42 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.421 2007/09/24 03:12:23 tgl Exp $
*
*--------------------------------------------------------------------
*/
@@ -736,47 +736,23 @@ static struct config_bool ConfigureNamesBool[] =
&Explain_pretty_print,
true, NULL, NULL
},
+
{
- {"stats_start_collector", PGC_POSTMASTER, STATS_COLLECTOR,
- gettext_noop("Starts the server statistics-collection subprocess."),
- NULL
- },
- &pgstat_collect_startcollector,
- true, NULL, NULL
- },
- {
- {"stats_reset_on_server_start", PGC_POSTMASTER, STATS_COLLECTOR,
- gettext_noop("Zeroes collected statistics on server restart."),
- NULL
- },
- &pgstat_collect_resetonpmstart,
- false, NULL, NULL
- },
- {
- {"stats_row_level", PGC_SUSET, STATS_COLLECTOR,
- gettext_noop("Collects row-level statistics on database activity."),
- NULL
+ {"track_activities", PGC_SUSET, STATS_COLLECTOR,
+ gettext_noop("Collects information about executing commands."),
+ gettext_noop("Enables the collection of information on the currently "
+ "executing command of each session, along with "
+ "the time at which that command began execution.")
},
- &pgstat_collect_tuplelevel,
+ &pgstat_track_activities,
true, NULL, NULL
},
{
- {"stats_block_level", PGC_SUSET, STATS_COLLECTOR,
- gettext_noop("Collects block-level statistics on database activity."),
+ {"track_counts", PGC_SUSET, STATS_COLLECTOR,
+ gettext_noop("Collects statistics on database activity."),
NULL
},
- &pgstat_collect_blocklevel,
- false, NULL, NULL
- },
-
- {
- {"stats_command_string", PGC_SUSET, STATS_COLLECTOR,
- gettext_noop("Collects information about executing commands."),
- gettext_noop("Enables the collection of information on the currently "
- "executing command of each session, along with the time "
- "at which that command began execution.")
- },
- &pgstat_collect_querystring,
+ &pgstat_track_counts,
true, NULL, NULL
},
@@ -1562,9 +1538,9 @@ static struct config_int ConfigureNamesInt[] =
{
{"log_min_duration_statement", PGC_SUSET, LOGGING_WHEN,
- gettext_noop("Sets the minimum execution time above which statements will "
- "be logged."),
- gettext_noop("Zero prints all queries. The default is -1 (turning this feature off)."),
+ gettext_noop("Sets the minimum execution time above which "
+ "statements will be logged."),
+ gettext_noop("Zero prints all queries. -1 turns this feature off."),
GUC_UNIT_MS
},
&log_min_duration_statement,
@@ -1572,13 +1548,13 @@ static struct config_int ConfigureNamesInt[] =
},
{
- {"log_autovacuum", PGC_SIGHUP, LOGGING_WHAT,
- gettext_noop("Sets the minimum execution time above which autovacuum actions "
- "will be logged."),
- gettext_noop("Zero prints all actions. The default is -1 (disabling autovacuum logging)."),
+ {"log_autovacuum_min_duration", PGC_SIGHUP, LOGGING_WHAT,
+ gettext_noop("Sets the minimum execution time above which "
+ "autovacuum actions will be logged."),
+ gettext_noop("Zero prints all actions. -1 turns autovacuum logging off."),
GUC_UNIT_MS
},
- &Log_autovacuum,
+ &Log_autovacuum_min_duration,
-1, -1, INT_MAX / 1000, NULL, NULL
},
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 3816210d85a..f63ba382017 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -358,15 +358,10 @@
# - Query/Index Statistics Collector -
-#stats_command_string = on
+#track_activities = on
+#track_counts = on
#update_process_title = on
-#stats_start_collector = on # needed for block or row stats
- # (change requires restart)
-#stats_block_level = off
-#stats_row_level = on
-#stats_reset_on_server_start = off # (change requires restart)
-
# - Statistics Monitoring -
@@ -381,13 +376,13 @@
#---------------------------------------------------------------------------
#autovacuum = on # enable autovacuum subprocess?
- # 'on' requires stats_start_collector
- # and stats_row_level to also be on
-#autovacuum_max_workers = 3 # max # of autovacuum subprocesses
-#autovacuum_naptime = 1min # time between autovacuum runs
-#log_autovacuum = -1 # -1 is disabled, 0 logs all actions
+ # 'on' requires track_counts
+ # to also be on
+#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions
# and their durations, > 0 logs only
# actions running at least N msec.
+#autovacuum_max_workers = 3 # max # of autovacuum subprocesses
+#autovacuum_naptime = 1min # time between autovacuum runs
#autovacuum_vacuum_threshold = 50 # min # of tuple updates before
# vacuum
#autovacuum_analyze_threshold = 50 # min # of tuple updates before
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 9cdeb2ee909..2f53fdcd7c8 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -5,7 +5,7 @@
*
* Copyright (c) 2001-2007, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.66 2007/09/20 17:56:32 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.67 2007/09/24 03:12:23 tgl Exp $
* ----------
*/
#ifndef PGSTAT_H
@@ -452,11 +452,8 @@ typedef struct PgBackendStatus
* GUC parameters
* ----------
*/
-extern bool pgstat_collect_startcollector;
-extern bool pgstat_collect_resetonpmstart;
-extern bool pgstat_collect_tuplelevel;
-extern bool pgstat_collect_blocklevel;
-extern bool pgstat_collect_querystring;
+extern bool pgstat_track_activities;
+extern bool pgstat_track_counts;
/*
* BgWriter statistics counters are updated directly by bgwriter and bufmgr
@@ -510,40 +507,40 @@ extern void pgstat_initstats(Relation rel);
/* nontransactional event counts are simple enough to inline */
-#define pgstat_count_heap_scan(rel) \
- do { \
- if (pgstat_collect_tuplelevel && (rel)->pgstat_info != NULL) \
- (rel)->pgstat_info->t_counts.t_numscans++; \
+#define pgstat_count_heap_scan(rel) \
+ do { \
+ if (pgstat_track_counts && (rel)->pgstat_info != NULL) \
+ (rel)->pgstat_info->t_counts.t_numscans++; \
} while (0)
-#define pgstat_count_heap_getnext(rel) \
- do { \
- if (pgstat_collect_tuplelevel && (rel)->pgstat_info != NULL) \
- (rel)->pgstat_info->t_counts.t_tuples_returned++; \
+#define pgstat_count_heap_getnext(rel) \
+ do { \
+ if (pgstat_track_counts && (rel)->pgstat_info != NULL) \
+ (rel)->pgstat_info->t_counts.t_tuples_returned++; \
} while (0)
-#define pgstat_count_heap_fetch(rel) \
- do { \
- if (pgstat_collect_tuplelevel && (rel)->pgstat_info != NULL) \
- (rel)->pgstat_info->t_counts.t_tuples_fetched++; \
+#define pgstat_count_heap_fetch(rel) \
+ do { \
+ if (pgstat_track_counts && (rel)->pgstat_info != NULL) \
+ (rel)->pgstat_info->t_counts.t_tuples_fetched++; \
} while (0)
-#define pgstat_count_index_scan(rel) \
- do { \
- if (pgstat_collect_tuplelevel && (rel)->pgstat_info != NULL) \
- (rel)->pgstat_info->t_counts.t_numscans++; \
+#define pgstat_count_index_scan(rel) \
+ do { \
+ if (pgstat_track_counts && (rel)->pgstat_info != NULL) \
+ (rel)->pgstat_info->t_counts.t_numscans++; \
} while (0)
-#define pgstat_count_index_tuples(rel, n) \
- do { \
- if (pgstat_collect_tuplelevel && (rel)->pgstat_info != NULL) \
- (rel)->pgstat_info->t_counts.t_tuples_returned += (n); \
+#define pgstat_count_index_tuples(rel, n) \
+ do { \
+ if (pgstat_track_counts && (rel)->pgstat_info != NULL) \
+ (rel)->pgstat_info->t_counts.t_tuples_returned += (n); \
} while (0)
-#define pgstat_count_buffer_read(rel) \
- do { \
- if (pgstat_collect_blocklevel && (rel)->pgstat_info != NULL) \
- (rel)->pgstat_info->t_counts.t_blocks_fetched++; \
+#define pgstat_count_buffer_read(rel) \
+ do { \
+ if (pgstat_track_counts && (rel)->pgstat_info != NULL) \
+ (rel)->pgstat_info->t_counts.t_blocks_fetched++; \
} while (0)
-#define pgstat_count_buffer_hit(rel) \
- do { \
- if (pgstat_collect_blocklevel && (rel)->pgstat_info != NULL) \
- (rel)->pgstat_info->t_counts.t_blocks_hit++; \
+#define pgstat_count_buffer_hit(rel) \
+ do { \
+ if (pgstat_track_counts && (rel)->pgstat_info != NULL) \
+ (rel)->pgstat_info->t_counts.t_blocks_hit++; \
} while (0)
extern void pgstat_count_heap_insert(Relation rel);
diff --git a/src/include/postmaster/autovacuum.h b/src/include/postmaster/autovacuum.h
index 27a982aafc5..d3e9ebe6c88 100644
--- a/src/include/postmaster/autovacuum.h
+++ b/src/include/postmaster/autovacuum.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/postmaster/autovacuum.h,v 1.11 2007/06/25 16:09:03 alvherre Exp $
+ * $PostgreSQL: pgsql/src/include/postmaster/autovacuum.h,v 1.12 2007/09/24 03:12:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,7 +31,7 @@ extern int autovacuum_vac_cost_limit;
/* autovacuum launcher PID, only valid when worker is shutting down */
extern int AutovacuumLauncherPid;
-extern int Log_autovacuum;
+extern int Log_autovacuum_min_duration;
/* Status inquiry functions */
extern bool AutoVacuumingActive(void);
diff --git a/src/test/regress/expected/stats.out b/src/test/regress/expected/stats.out
index af0f630a8da..00811e2145f 100644
--- a/src/test/regress/expected/stats.out
+++ b/src/test/regress/expected/stats.out
@@ -5,9 +5,9 @@
-- populated (by create_misc) and indexed (by create_index).
--
-- conditio sine qua non
-SHOW stats_start_collector; -- must be on
- stats_start_collector
------------------------
+SHOW track_counts; -- must be on
+ track_counts
+--------------
on
(1 row)
@@ -56,9 +56,6 @@ begin
extract(epoch from clock_timestamp() - start_time);
end
$$ language plpgsql;
--- enable statistics
-SET stats_block_level = on;
-SET stats_row_level = on;
-- do a seqscan
SELECT count(*) FROM tenk2;
count
diff --git a/src/test/regress/sql/stats.sql b/src/test/regress/sql/stats.sql
index 9900b9114a5..4a72a949f29 100644
--- a/src/test/regress/sql/stats.sql
+++ b/src/test/regress/sql/stats.sql
@@ -6,7 +6,7 @@
--
-- conditio sine qua non
-SHOW stats_start_collector; -- must be on
+SHOW track_counts; -- must be on
-- wait to let any prior tests finish dumping out stats;
-- else our messages might get lost due to contention
@@ -51,10 +51,6 @@ begin
end
$$ language plpgsql;
--- enable statistics
-SET stats_block_level = on;
-SET stats_row_level = on;
-
-- do a seqscan
SELECT count(*) FROM tenk2;
-- do an indexscan