#include "history_compress.h"
#if defined(HAVE_POSTGRESQL)
#define ZBX_TS_SEGMENT_BY "itemid"
#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 (0 == ZBX_DB_TSDB_V1 ? "remove_compression_policy" : \
"remove_compress_chunks_policy")
#define COMPRESSION_POLICY_ADD (0 == ZBX_DB_TSDB_V1 ? "add_compression_policy" : \
"add_compress_chunks_policy")
ZBX_COMPRESS_TABLE_HISTORY = 0,
ZBX_COMPRESS_TABLE_TRENDS
zbx_compress_table_t type;
} zbx_history_table_compression_options_t;
static zbx_history_table_compression_options_t compression_tables[] = {
{"history", ZBX_COMPRESS_TABLE_HISTORY},
{"history_uint", ZBX_COMPRESS_TABLE_HISTORY},
{"history_str", ZBX_COMPRESS_TABLE_HISTORY},
{"history_text", ZBX_COMPRESS_TABLE_HISTORY},
{"history_log", ZBX_COMPRESS_TABLE_HISTORY},
{"trends", ZBX_COMPRESS_TABLE_TRENDS},
{"trends_uint", ZBX_COMPRESS_TABLE_TRENDS}
static unsigned char compression_status_cache = 0;
static int compress_older_cache = 0;