Knowledge base · Nov 2026

Point-in-time queries

Reading a historized table as it was on a given date, and joining facts to the attributes valid at their own time.

A historized table (a Data Vault satellite, an SCD2 dimension) keeps one row per change. Two queries cover most needs.

State on a date — the latest row at or before it:

SELECT *
FROM sat_customer
WHERE load_dts <= DATE '2024-03-01'
QUALIFY row_number() OVER (PARTITION BY customer_hk ORDER BY load_dts DESC) = 1

Facts with the attributes of their time — an as-of join:

SELECT o.order_id, s.tier
FROM link_order o
ASOF JOIN sat_customer s
  ON s.customer_hk = o.customer_hk AND o.load_dts >= s.load_dts

Without the second form, every past order is labelled with the customer’s current attributes, which silently rewrites history in every report built on it.