#endif
static bool online_analyze_enable = true;
+static bool online_analyze_local_tracking = false;
static bool online_analyze_verbose = true;
static double online_analyze_scale_factor = 0.1;
static int online_analyze_threshold = 50;
{
/* only analyze */
rstat->changes_since_analyze = 0;
+ rstat->analyze_timestamp = now;
return;
}
Assert(rstat->tableid == relOid);
- /* do not rered data if it was a truncation */
- if (operation != CK_TRUNCATE && operation != CK_FASTTRUNCATE &&
- (newTable == true || rstat->rereadStat == true))
+ if (
+ /* do not reread data if it was a truncation */
+ operation != CK_TRUNCATE && operation != CK_FASTTRUNCATE &&
+ /* read for persistent table and for temp teble if it allowed */
+ (reltype == OATT_PERSISTENT || online_analyze_local_tracking == false) &&
+ /* read only for new table or we know that it's needed */
+ (newTable == true || rstat->rereadStat == true)
+ )
{
rstat->rereadStat = false;
NULL
);
+ DefineCustomBoolVariable(
+ "online_analyze.local_tracking",
+ "Per backend tracking",
+ "Per backend tracking for temp tables (do not use system statistic)",
+ &online_analyze_local_tracking,
+#if PG_VERSION_NUM >= 80400
+ online_analyze_local_tracking,
+#endif
+ PGC_USERSET,
+#if PG_VERSION_NUM >= 80400
+ GUC_NOT_IN_SAMPLE,
+#if PG_VERSION_NUM >= 90100
+ NULL,
+#endif
+#endif
+ NULL,
+ NULL
+ );
+
DefineCustomBoolVariable(
"online_analyze.verbose",
"Verbosity of on-line analyze",