#include "history_compress.h"
#if defined(HAVE_POSTGRESQL)
#define ZBX_TS_UNIX_NOW "zbx_ts_unix_now"
#define ZBX_TS_UNIX_NOW_CREATE "create or replace function "ZBX_TS_UNIX_NOW"() returns integer language sql" \
" stable as $$ select extract(epoch from now())::integer $$"
#define COMPRESSION_TOLERANCE (SEC_PER_HOUR * 2)
#define COMPRESSION_POLICY_REMOVE "remove_compression_policy"
#define COMPRESSION_POLICY_ADD "add_compression_policy"
#define POLICY_COMPRESS_AFTER 0
#define POLICY_COMPRESS_CREATED_BEFORE 1
} zbx_history_table_compression_options_t;
static zbx_history_table_compression_options_t compression_tables[] = {
{"history", "itemid", "clock,ns", POLICY_COMPRESS_AFTER},
{"history_uint", "itemid", "clock,ns", POLICY_COMPRESS_AFTER},
{"history_str", "itemid", "clock,ns", POLICY_COMPRESS_AFTER},
{"history_text", "itemid", "clock,ns", POLICY_COMPRESS_AFTER},
{"history_log", "itemid", "clock,ns", POLICY_COMPRESS_AFTER},
{"history_bin", "itemid", "clock,ns", POLICY_COMPRESS_AFTER},
{"trends", "itemid", "clock", POLICY_COMPRESS_AFTER},
{"trends_uint", "itemid", "clock", POLICY_COMPRESS_AFTER},
{"auditlog", "auditid", "clock", POLICY_COMPRESS_CREATED_BEFORE}
static unsigned char compression_status_cache = 0;
static int compress_older_cache = 0;