Files
ljwx-deploy/apps/ljwx-health/base/sql/epic-360/00-health-olap-recon.sql
T

14 lines
724 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- V3.1.30: PG↔ClickHouse 对账审计表(Epic #238 M6 / issue #244)
-- consumer 侧 recon 应用按日写入;连续 7 天 diff<=阈值为旁路接管读流量的运行期验收前提。
-- 本地开发不走 Flyway:用 psql 直接应用本文件。
CREATE TABLE IF NOT EXISTS t_health_olap_recon (
recon_day DATE PRIMARY KEY,
pg_count BIGINT NOT NULL,
ch_count BIGINT, -- NULL = ClickHouse 当日不可达
diff BIGINT, -- NULL = 无法计算(CH 不可达)
checked_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
COMMENT ON TABLE t_health_olap_recon IS '#244 M6: PG(t_user_health_data) vs ClickHouse(t_health_raw) 日级对账审计';