diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 5c8db97..d7707ac 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -5665,6 +5665,20 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
       </listitem>
      </varlistentry>
 
+     <varlistentry id="guc-autovacuum-wipe-orphan-temp-tables" xreflabel="autovacuum_wipe_orphan_temp_tables">
+      <term><varname>autovacuum_wipe_orphan_temp_tables</varname> (<type>boolean</type>)
+      <indexterm>
+       <primary><varname>autovacuum_wipe_orphan_temp_tables</> configuration parameter</primary>
+      </indexterm>
+      </term>
+      <listitem>
+       <para>
+        Controls whether the server should drop orphan temporary tables during
+        autovacuum. This is on by default.
+       </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>)
       <indexterm>
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3768f50..e5318f4 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -123,6 +123,8 @@ int			autovacuum_vac_cost_limit;
 
 int			Log_autovacuum_min_duration = -1;
 
+bool		autovacuum_wipe_orphan_temp_tables = true;
+
 /* how long to keep pgstat data in the launcher, in milliseconds */
 #define STATS_READ_DELAY 1000
 
@@ -2052,7 +2054,7 @@ do_autovacuum(void)
 				 * vacuum for wraparound, forcibly drop it.  Otherwise just
 				 * log a complaint.
 				 */
-				if (wraparound)
+				if (wraparound || autovacuum_wipe_orphan_temp_tables)
 				{
 					ObjectAddress object;
 
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index c5178f7..d0695ba 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -1227,6 +1227,15 @@ static struct config_bool ConfigureNamesBool[] =
 		true,
 		NULL, NULL, NULL
 	},
+	{
+		{"autovacuum_wipe_orphan_temp_tables", PGC_SIGHUP, AUTOVACUUM,
+			gettext_noop("Forces autovacuum to wipe orphan temp tables on sight."),
+			NULL
+		},
+		&autovacuum_wipe_orphan_temp_tables,
+		true,
+		NULL, NULL, NULL
+	},
 
 	{
 		{"trace_notify", PGC_USERSET, DEVELOPER_OPTIONS,
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 6d0666c..21b65b7 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -519,6 +519,7 @@
 #autovacuum_vacuum_cost_limit = -1	# default vacuum cost limit for
 					# autovacuum, -1 means use
 					# vacuum_cost_limit
+#autovacuum_wipe_orphan_temp_tables = on	# Drop orphan temp tables during autovacuum?  'on'
 
 
 #------------------------------------------------------------------------------
diff --git a/src/include/postmaster/autovacuum.h b/src/include/postmaster/autovacuum.h
index b5000b0..05b7a71 100644
--- a/src/include/postmaster/autovacuum.h
+++ b/src/include/postmaster/autovacuum.h
@@ -34,6 +34,8 @@ extern int	AutovacuumLauncherPid;
 
 extern int	Log_autovacuum_min_duration;
 
+extern bool autovacuum_wipe_orphan_temp_tables;
+
 /* Status inquiry functions */
 extern bool AutoVacuumingActive(void);
 extern bool IsAutoVacuumLauncherProcess(void);
