online_analyze.min_interval = 10000
Minimum time interval between analyze call per table (in milliseconds)
+online_analyze.lower_limit = 0
+ Min number of rows in table to analyze
+
online_analyze.table_type = "all"
Type(s) of table for online analyze: all, persistent, temporary, none
static int online_analyze_threshold = 50;
static int online_analyze_capacity_threshold = 100000;
static double online_analyze_min_interval = 10000;
+static int online_analyze_lower_limit = 0;
static ExecutorEnd_hook_type oldExecutorEndHook = NULL;
#if PG_VERSION_NUM >= 90200
#endif
static void
-makeAnalyze(Oid relOid, CmdType operation, int32 naffected)
+makeAnalyze(Oid relOid, CmdType operation, int64 naffected)
{
TimestampTz now = GetCurrentTimestamp();
Relation rel;
/* do not analyze too often, if both stamps are exceeded the go */
TimestampDifferenceExceeds(rstat->analyze_timestamp, now, online_analyze_min_interval) &&
TimestampDifferenceExceeds(rstat->autovac_analyze_timestamp, now, online_analyze_min_interval) &&
+ /* do not analyze too small tables */
+ rstat->n_tuples + rstat->changes_since_analyze + naffected > online_analyze_lower_limit &&
/* be in sync with relation_needs_vacanalyze */
((double)(rstat->changes_since_analyze + naffected)) >=
online_analyze_scale_factor * ((double)rstat->n_tuples) +
void
onlineAnalyzeHooker(QueryDesc *queryDesc)
{
- uint32 naffected = -1;
+ int64 naffected = -1;
if (queryDesc->estate)
naffected = queryDesc->estate->es_processed;
#endif
includeTablesShow
);
+
+ DefineCustomIntVariable(
+ "online_analyze.lower_limit",
+ "min number of rows in table to analyze",
+ "min number of rows in table to analyze",
+ &online_analyze_lower_limit,
+#if PG_VERSION_NUM >= 80400
+ online_analyze_lower_limit,
+#endif
+ 0,
+ 0x7fffffff,
+ PGC_USERSET,
+#if PG_VERSION_NUM >= 80400
+ GUC_NOT_IN_SAMPLE,
+#if PG_VERSION_NUM >= 90100
+ NULL,
+#endif
+#endif
+ NULL,
+ NULL
+ );
+
}
void _PG_fini(void);