mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-31 00:03:57 -04:00 
			
		
		
		
	Simplify and rename some GUC variables, per various recent discussions:
* stats_start_collector goes away; we always start the collector process, unless prevented by a problem with setting up the stats UDP socket. * stats_reset_on_server_start goes away; it seems useless in view of the availability of pg_stat_reset(). * stats_block_level and stats_row_level are merged into a single variable "track_counts", which controls all reports sent to the collector process. * stats_command_string is renamed to track_activities. * log_autovacuum is renamed to log_autovacuum_min_duration to better reflect its meaning. The log_autovacuum change is not a compatibility issue since it didn't exist before 8.3 anyway. The other changes need to be release-noted.
This commit is contained in:
		
							parent
							
								
									02138357ff
								
							
						
					
					
						commit
						48f7e64395
					
				| @ -1,4 +1,4 @@ | ||||
| <!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.145 2007/09/22 19:10:44 tgl Exp $ --> | ||||
| <!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.146 2007/09/24 03:12:23 tgl Exp $ --> | ||||
| 
 | ||||
| <chapter Id="runtime-config"> | ||||
|   <title>Server Configuration</title> | ||||
| @ -3186,30 +3186,19 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; | ||||
|      <title>Query and Index Statistics Collector</title> | ||||
| 
 | ||||
|      <para> | ||||
|       These parameters control a server-wide statistics collection feature. | ||||
|       These parameters control server-wide statistics collection features. | ||||
|       When statistics collection is enabled, the data that is produced can be | ||||
|       accessed via the <structname>pg_stat</structname> and | ||||
|       <structname>pg_statio</structname> family of system views. | ||||
|       Refer to <xref linkend="monitoring"> for more information. | ||||
|      </para> | ||||
| 
 | ||||
|      <note> | ||||
|      <para> | ||||
|       As of <productname>PostgreSQL</productname> 8.2, | ||||
|       <varname>stats_command_string</varname> controls a separate data | ||||
|       collection mechanism that can be turned on or off independently | ||||
|       of whether the statistics-collection subprocess is running. | ||||
|       The subprocess is only needed to support collection of | ||||
|       block-level or row-level statistics. | ||||
|      </para> | ||||
|      </note> | ||||
| 
 | ||||
|      <variablelist> | ||||
| 
 | ||||
|      <varlistentry id="guc-stats-command-string" xreflabel="stats_command_string"> | ||||
|       <term><varname>stats_command_string</varname> (<type>boolean</type>)</term> | ||||
|      <varlistentry id="guc-track-activities" xreflabel="track_activities"> | ||||
|       <term><varname>track_activities</varname> (<type>boolean</type>)</term> | ||||
|       <indexterm> | ||||
|        <primary><varname>stats_command_string</> configuration parameter</primary> | ||||
|        <primary><varname>track_activities</> configuration parameter</primary> | ||||
|       </indexterm> | ||||
|       <listitem> | ||||
|        <para> | ||||
| @ -3225,6 +3214,21 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; | ||||
|       </listitem> | ||||
|      </varlistentry> | ||||
| 
 | ||||
|      <varlistentry id="guc-track-counts" xreflabel="track_counts"> | ||||
|       <term><varname>track_counts</varname> (<type>boolean</type>)</term> | ||||
|       <indexterm> | ||||
|        <primary><varname>track_counts</> configuration parameter</primary> | ||||
|       </indexterm> | ||||
|       <listitem> | ||||
|        <para> | ||||
|         Enables collection of statistics on database activity. | ||||
|         This parameter is on by default, because the autovacuum | ||||
|         daemon needs the collected information. | ||||
|         Only superusers can change this setting. | ||||
|        </para> | ||||
|       </listitem> | ||||
|      </varlistentry> | ||||
| 
 | ||||
|      <varlistentry id="guc-update-process-title" xreflabel="update_process_title"> | ||||
|       <term><varname>update_process_title</varname> (<type>boolean</type>)</term> | ||||
|       <indexterm> | ||||
| @ -3234,75 +3238,13 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; | ||||
|        <para> | ||||
|         Enables updating of the process title every time a new SQL command | ||||
|         is received by the server.  The process title is typically viewed | ||||
|         by the <command>ps</> command or in Windows using the <application>Process | ||||
|         Explorer</>.   Only superusers can change this setting. | ||||
|        </para> | ||||
|       </listitem> | ||||
|      </varlistentry> | ||||
| 
 | ||||
|      <varlistentry id="guc-stats-start-collector" xreflabel="stats_start_collector"> | ||||
|       <term><varname>stats_start_collector</varname> (<type>boolean</type>)</term> | ||||
|       <indexterm> | ||||
|        <primary><varname>stats_start_collector</> configuration parameter</primary> | ||||
|       </indexterm> | ||||
|       <listitem> | ||||
|        <para> | ||||
|         Controls whether the server should start the | ||||
|         statistics-collection subprocess.  This is on by default, but | ||||
|         can be turned off if you know you have no interest in | ||||
|         collecting statistics or running autovacuum. | ||||
|         This parameter can only be set at server start, because the collection | ||||
|         subprocess cannot be started or stopped on-the-fly.  (However, the | ||||
|         extent to which statistics are actually gathered can be changed while | ||||
|         the server is running, so long as the subprocess exists.) | ||||
|        </para> | ||||
|       </listitem> | ||||
|      </varlistentry> | ||||
| 
 | ||||
|      <varlistentry id="guc-stats-block-level" xreflabel="stats_block_level"> | ||||
|       <term><varname>stats_block_level</varname> (<type>boolean</type>)</term> | ||||
|       <indexterm> | ||||
|        <primary><varname>stats_block_level</> configuration parameter</primary> | ||||
|       </indexterm> | ||||
|       <listitem> | ||||
|        <para> | ||||
|         Enables the collection of block-level statistics on database | ||||
|         activity. This parameter is off by default. | ||||
|         by the <command>ps</> command, | ||||
|         or in Windows by using the <application>Process Explorer</>. | ||||
|         Only superusers can change this setting. | ||||
|        </para> | ||||
|       </listitem> | ||||
|      </varlistentry> | ||||
| 
 | ||||
|      <varlistentry id="guc-stats-row-level" xreflabel="stats_row_level"> | ||||
|       <term><varname>stats_row_level</varname> (<type>boolean</type>)</term> | ||||
|       <indexterm> | ||||
|        <primary><varname>stats_row_level</> configuration parameter</primary> | ||||
|       </indexterm> | ||||
|       <listitem> | ||||
|        <para> | ||||
|         Enables the collection of row-level statistics on database | ||||
|         activity. This parameter is on by default, because the autovacuum | ||||
|         daemon needs the collected information. | ||||
|         Only superusers can change this setting. | ||||
|        </para> | ||||
|       </listitem> | ||||
|      </varlistentry> | ||||
| 
 | ||||
|      <varlistentry id="guc-stats-reset-on-server-start" xreflabel="stats_reset_on_server_start"> | ||||
|       <term><varname>stats_reset_on_server_start</varname> (<type>boolean</type>)</term> | ||||
|       <indexterm> | ||||
|        <primary><varname>stats_reset_on_server_start</> configuration parameter</primary> | ||||
|       </indexterm> | ||||
|       <listitem> | ||||
|        <para> | ||||
|         If on, collected block-level and row-level statistics are zeroed out | ||||
|         whenever the server is restarted. If off, statistics are accumulated | ||||
|         across server restarts. This parameter is off by default. | ||||
|         This parameter can only be set at server start. | ||||
|        </para> | ||||
|       </listitem> | ||||
|      </varlistentry> | ||||
| 
 | ||||
|      </variablelist> | ||||
|     </sect2> | ||||
| 
 | ||||
| @ -3369,21 +3311,40 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; | ||||
|       <listitem> | ||||
|        <para> | ||||
|         Controls whether the server should run the | ||||
|         autovacuum launcher daemon.  This is on by default. | ||||
|         <varname>stats_start_collector</> and <varname>stats_row_level</> | ||||
|         must also be turned on for autovacuum to work. | ||||
|         autovacuum launcher daemon.  This is on by default; however, | ||||
|         <xref linkend="guc-track-counts"> must also be turned on for | ||||
|         autovacuum to work. | ||||
|         This parameter can only be set in the <filename>postgresql.conf</> | ||||
|         file or on the server command line. | ||||
|        </para> | ||||
|        <para> | ||||
|         Note that even when this parameter is disabled, the system | ||||
|         will periodically launch autovacuum processes in order to | ||||
|         will launch autovacuum processes if necessary to | ||||
|         prevent transaction ID wraparound.  See <xref | ||||
|         linkend="vacuum-for-wraparound"> for more information. | ||||
|        </para> | ||||
|       </listitem> | ||||
|      </varlistentry> | ||||
| 
 | ||||
|      <varlistentry id="guc-log-autovacuum-min-duration" xreflabel="log_autovacuum_min_duration"> | ||||
|       <term><varname>log_autovacuum_min_duration</varname> (<type>integer</type>)</term> | ||||
|       <indexterm> | ||||
|        <primary><varname>log_autovacuum_min_duration</> configuration parameter</primary> | ||||
|       </indexterm> | ||||
|       <listitem> | ||||
|        <para> | ||||
|         Causes each action executed by autovacuum to be logged if it ran for at | ||||
|         least the specified number of milliseconds.  Setting this to zero logs | ||||
|         all autovacuum actions. Minus-one (the default) disables logging | ||||
|         autovacuum actions.  For example, if you set this to | ||||
|         <literal>250ms</literal> then all automatic vacuums and analyzes that run | ||||
|         250ms or longer will be logged.  Enabling this parameter can be helpful | ||||
|         in tracking autovacuum activity.  This setting can only be set in | ||||
|         the <filename>postgresql.conf</> file or on the server command line. | ||||
|        </para> | ||||
|       </listitem> | ||||
|      </varlistentry> | ||||
| 
 | ||||
|      <varlistentry id="guc-autovacuum-max-workers" xreflabel="autovacuum_max_workers"> | ||||
|       <term><varname>autovacuum_max_workers</varname> (<type>integer</type>)</term> | ||||
|       <indexterm> | ||||
| @ -3393,26 +3354,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; | ||||
|        <para> | ||||
|         Specifies the maximum number of autovacuum processes (other than the | ||||
|         autovacuum launcher) which may be running at any one time.  The default | ||||
|         is three (<literal>3</literal>).  This parameter can only be set in | ||||
|         the <filename>postgresql.conf</> file or on the server command line. | ||||
|        </para> | ||||
|       </listitem> | ||||
|      </varlistentry> | ||||
| 
 | ||||
|      <varlistentry id="guc-log-autovacuum" xreflabel="log_autovacuum"> | ||||
|       <term><varname>log_autovacuum</varname> (<type>integer</type>)</term> | ||||
|       <indexterm> | ||||
|        <primary><varname>log_autovacuum</> configuration parameter</primary> | ||||
|       </indexterm> | ||||
|       <listitem> | ||||
|        <para> | ||||
|         Causes each action executed by autovacuum to be logged if it ran for at | ||||
|         least the specified number of milliseconds.  Setting this to zero logs | ||||
|         all autovacuum actions. Minus-one (the default) disables logging | ||||
|         autovacuum actions.  For example, if you set this to | ||||
|         <literal>250ms</literal> then all vacuums and analyzes that run | ||||
|         250ms or longer will be logged.  Enabling this parameter can be helpful | ||||
|         in tracking autovacuum activity.  This setting can only be set in | ||||
|         is three.  This parameter can only be set in | ||||
|         the <filename>postgresql.conf</> file or on the server command line. | ||||
|        </para> | ||||
|       </listitem> | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| <!-- $PostgreSQL: pgsql/doc/src/sgml/maintenance.sgml,v 1.81 2007/09/14 13:43:03 momjian Exp $ --> | ||||
| <!-- $PostgreSQL: pgsql/doc/src/sgml/maintenance.sgml,v 1.82 2007/09/24 03:12:23 tgl Exp $ --> | ||||
| 
 | ||||
| <chapter id="maintenance"> | ||||
|  <title>Routine Database Maintenance Tasks</title> | ||||
| @ -203,7 +203,7 @@ | ||||
|   </sect2> | ||||
| 
 | ||||
|   <sect2 id="vacuum-for-statistics"> | ||||
|    <title>Updating planner statistics</title> | ||||
|    <title>Updating Planner Statistics</title> | ||||
| 
 | ||||
|    <indexterm zone="vacuum-for-statistics"> | ||||
|     <primary>statistics</primary> | ||||
| @ -279,7 +279,7 @@ | ||||
|   </sect2> | ||||
| 
 | ||||
|   <sect2 id="vacuum-for-wraparound"> | ||||
|    <title>Preventing transaction ID wraparound failures</title> | ||||
|    <title>Preventing Transaction ID Wraparound Failures</title> | ||||
| 
 | ||||
|    <indexterm zone="vacuum-for-wraparound"> | ||||
|     <primary>transaction ID</primary> | ||||
| @ -460,7 +460,7 @@ HINT:  Stop the postmaster and use a standalone backend to VACUUM in "mydb". | ||||
|   </sect2> | ||||
| 
 | ||||
|   <sect2 id="autovacuum"> | ||||
|    <title id="autovacuum-title">The auto-vacuum daemon</title> | ||||
|    <title id="autovacuum-title">The Auto-Vacuum Daemon</title> | ||||
| 
 | ||||
|    <indexterm> | ||||
|     <primary>autovacuum</primary> | ||||
| @ -473,10 +473,9 @@ HINT:  Stop the postmaster and use a standalone backend to VACUUM in "mydb". | ||||
|     <command>VACUUM</command> and <command>ANALYZE </command> commands. | ||||
|     When enabled, autovacuum checks for | ||||
|     tables that have had a large number of inserted, updated or deleted | ||||
|     tuples.  These checks use the row-level statistics collection facility; | ||||
|     tuples.  These checks use the statistics collection facility; | ||||
|     therefore, autovacuum cannot be used unless <xref | ||||
|     linkend="guc-stats-start-collector"> and <xref | ||||
|     linkend="guc-stats-row-level"> are set to <literal>true</literal>. | ||||
|     linkend="guc-track-counts"> is set to <literal>true</literal>. | ||||
|     In the default configuration, autovacuuming is enabled and the related | ||||
|     configuration parameters are appropriately set. | ||||
|    </para> | ||||
| @ -497,8 +496,8 @@ HINT:  Stop the postmaster and use a standalone backend to VACUUM in "mydb". | ||||
|     eligible for vacuuming in a short amount of time, all autovacuum workers | ||||
|     may end up vacuuming those tables for a very long time. This would result | ||||
|     in other tables and databases not being vacuumed until a worker became | ||||
|     available. There is also not a limit on how many workers might be in a | ||||
|     single database, but workers do try and avoid repeating work that has | ||||
|     available. There is not a limit on how many workers might be in a | ||||
|     single database, but workers do try to avoid repeating work that has | ||||
|     already been done by other workers. Note that the number of running | ||||
|     workers does not count towards the <xref linkend="guc-max-connections"> nor | ||||
|     the <xref linkend="guc-superuser-reserved-connections"> limits. | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| <!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.52 2007/09/20 17:56:30 tgl Exp $ --> | ||||
| <!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.53 2007/09/24 03:12:23 tgl Exp $ --> | ||||
| 
 | ||||
| <chapter id="monitoring"> | ||||
|  <title>Monitoring Database Activity</title> | ||||
| @ -117,14 +117,15 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re | ||||
|    <productname>PostgreSQL</productname>'s <firstterm>statistics collector</> | ||||
|    is a subsystem that supports collection and reporting of information about | ||||
|    server activity.  Presently, the collector can count accesses to tables | ||||
|    and indexes in both disk-block and individual-row terms. | ||||
|    and indexes in both disk-block and individual-row terms.  It also tracks | ||||
|    total numbers of rows in each table, and the last vacuum and analyze times | ||||
|    for each table. | ||||
|   </para> | ||||
| 
 | ||||
|   <para> | ||||
|    <productname>PostgreSQL</productname> also supports determining the exact | ||||
|    command currently being executed by other server processes.  This is an | ||||
|    independent facility that can be enabled or disabled whether or not | ||||
|    block-level and row-level statistics are being collected. | ||||
|    independent facility that does not depend on the collector process. | ||||
|   </para> | ||||
| 
 | ||||
|  <sect2 id="monitoring-stats-setup"> | ||||
| @ -139,31 +140,14 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re | ||||
|   </para> | ||||
| 
 | ||||
|   <para> | ||||
|    The parameter <xref linkend="guc-stats-start-collector"> must be | ||||
|    set to <literal>true</> for the statistics collector to be launched | ||||
|    at all.  This is the default and recommended setting, but it can be | ||||
|    turned off if you have no interest in statistics and want to | ||||
|    squeeze out every last drop of overhead.  (The savings is likely to | ||||
|    be small, however.)  Note that this option cannot be changed while | ||||
|    the server is running. | ||||
|    The parameter <xref linkend="guc-track-counts"> controls whether | ||||
|    information is actually sent to the collector process and thus determines | ||||
|    whether any run-time overhead occurs for event counting. | ||||
|   </para> | ||||
| 
 | ||||
|   <para> | ||||
|    The parameters <xref linkend="guc-stats-block-level"> and <xref | ||||
|    linkend="guc-stats-row-level"> control how much information is | ||||
|    actually sent to the collector and thus determine how much run-time | ||||
|    overhead occurs.  These respectively determine whether a server | ||||
|    process tracks disk-block-level access | ||||
|    statistics and row-level access statistics and sends these to the collector. | ||||
|    Additionally, per-database transaction commit and abort statistics | ||||
|    are collected if either of these parameters are set. | ||||
|   </para> | ||||
| 
 | ||||
|   <para> | ||||
|    The parameter <xref linkend="guc-stats-command-string"> enables monitoring | ||||
|    The parameter <xref linkend="guc-track-activities"> enables monitoring | ||||
|    of the current command being executed by any server process. | ||||
|    The statistics collector subprocess need not be running to enable this | ||||
|    feature. | ||||
|   </para> | ||||
|    | ||||
|   <para> | ||||
| @ -190,13 +174,13 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re | ||||
|   <para> | ||||
|    When using the statistics to monitor current activity, it is important | ||||
|    to realize that the information does not update instantaneously. | ||||
|    Each individual server process transmits new block and row access counts to | ||||
|    Each individual server process transmits new statistical counts to | ||||
|    the collector just before going idle; so a query or transaction still in | ||||
|    progress does not affect the displayed totals.  Also, the collector itself | ||||
|    emits a new report at most once per <varname>PGSTAT_STAT_INTERVAL</varname> | ||||
|    milliseconds (500 unless altered while building the server).  So the | ||||
|    displayed information lags behind actual activity.  However, current-query | ||||
|    information collected by <varname>stats_command_string</varname> is | ||||
|    information collected by <varname>track_activities</varname> is | ||||
|    always up-to-date. | ||||
|   </para> | ||||
| 
 | ||||
| @ -240,7 +224,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re | ||||
|       current query began execution, time at which the process was | ||||
|       started, and client's address and port number.  The columns that | ||||
|       report data on the current query are available unless the parameter | ||||
|       <varname>stats_command_string</varname> has been turned off. | ||||
|       <varname>track_activities</varname> has been turned off. | ||||
|       Furthermore, these columns are only visible if the user examining | ||||
|       the view is a superuser or the same as the user owning the process | ||||
|       being reported on. | ||||
| @ -715,7 +699,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re | ||||
|        Active command of the given server process, but only if the | ||||
|        current user is a superuser or the same user as that of | ||||
|        the session being queried (and | ||||
|        <varname>stats_command_string</varname> is on) | ||||
|        <varname>track_activities</varname> is on) | ||||
|       </entry> | ||||
|      </row> | ||||
| 
 | ||||
| @ -726,7 +710,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re | ||||
|        True if the given server process is waiting for a lock, | ||||
|        but only if the current user is a superuser or the same user as that of | ||||
|        the session being queried (and | ||||
|        <varname>stats_command_string</varname> is on) | ||||
|        <varname>track_activities</varname> is on) | ||||
|       </entry> | ||||
|      </row> | ||||
| 
 | ||||
| @ -738,7 +722,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re | ||||
|        executing query was started, but only if the | ||||
|        current user is a superuser or the same user as that of | ||||
|        the session being queried (and | ||||
|        <varname>stats_command_string</varname> is on) | ||||
|        <varname>track_activities</varname> is on) | ||||
|       </entry> | ||||
|      </row> | ||||
| 
 | ||||
| @ -750,7 +734,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re | ||||
|        executing transaction was started, but only if the | ||||
|        current user is a superuser or the same user as that of | ||||
|        the session being queried (and | ||||
|        <varname>stats_command_string</varname> is on) | ||||
|        <varname>track_activities</varname> is on) | ||||
|       </entry> | ||||
|      </row> | ||||
| 
 | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| <!-- $PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.507 2007/09/16 03:03:00 tgl Exp $ --> | ||||
| <!-- $PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.508 2007/09/24 03:12:23 tgl Exp $ --> | ||||
| <!-- | ||||
| 
 | ||||
| Typical markup: | ||||
| @ -1475,8 +1475,7 @@ do it for earlier branch release files. | ||||
|       <listitem> | ||||
|        <para> | ||||
|         Improve performance of statistics monitoring, especially | ||||
|         <link | ||||
|         linkend="guc-stats-command-string"><varname>stats_command_string</></link> | ||||
|         <varname>stats_command_string</> | ||||
|         (Tom, Bruce) | ||||
|        </para> | ||||
| 
 | ||||
|  | ||||
| @ -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), | ||||
|  | ||||
| @ -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" | ||||
|  | ||||
| @ -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."))); | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  | ||||
| @ -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). | ||||
| @ -256,28 +254,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 | ||||
| 	 */ | ||||
| @ -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; | ||||
| 
 | ||||
| 	/*
 | ||||
| @ -571,22 +549,6 @@ pgstat_start(void) | ||||
| 		return 0; | ||||
| 	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. | ||||
| 	 */ | ||||
| @ -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; | ||||
| 
 | ||||
| 	/*
 | ||||
|  | ||||
| @ -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 | ||||
| 		}, | ||||
| 		&pgstat_collect_tuplelevel, | ||||
| 		true, NULL, NULL | ||||
| 	}, | ||||
| 	{ | ||||
| 		{"stats_block_level", PGC_SUSET, STATS_COLLECTOR, | ||||
| 			gettext_noop("Collects block-level statistics on database activity."), | ||||
| 			NULL | ||||
| 		}, | ||||
| 		&pgstat_collect_blocklevel, | ||||
| 		false, NULL, NULL | ||||
| 	}, | ||||
| 
 | ||||
| 	{ | ||||
| 		{"stats_command_string", PGC_SUSET, STATS_COLLECTOR, | ||||
| 		{"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.") | ||||
| 						 "executing command of each session, along with " | ||||
| 						 "the time at which that command began execution.") | ||||
| 		}, | ||||
| 		&pgstat_collect_querystring, | ||||
| 		&pgstat_track_activities, | ||||
| 		true, NULL, NULL | ||||
| 	}, | ||||
| 	{ | ||||
| 		{"track_counts", PGC_SUSET, STATS_COLLECTOR, | ||||
| 			gettext_noop("Collects statistics on database activity."), | ||||
| 			NULL | ||||
| 		}, | ||||
| 		&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 | ||||
| 	}, | ||||
| 
 | ||||
|  | ||||
| @ -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  | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -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  | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user