| Actor | Fragment | Worker | State |
|---|---|---|---|
| 742992 | 62704 | 51 | running |
| 742993 | 62704 | 51 | running |
| 742994 | 62696 | 51 | running |
| 742995 | 62696 | 51 | running |
| 744219 | 62695 | 51 | running |
| 744220 | 62695 | 51 | running |
| 744221 | 62697 | 51 | running |
| 744222 | 62697 | 51 | running |
| 744223 | 62698 | 51 | running |
| 744224 | 62698 | 51 | running |
| 744225 | 62703 | 51 | running |
| 744226 | 62703 | 51 | running |
CREATE MATERIALIZED VIEW authz.active_parties_to_accounts_mv
WITH (
backfill_order=FIXED(party.customer_relationships_next -> olap.party_involvements_dm)
) AS
SELECT
inv.party_id,
inv.entity_id AS account_id,
MAX(
GREATEST(
COALESCE(cr.updated_at, CAST(inv.effective_from AS TIMESTAMPTZ)),
COALESCE(cr.status_changed_at, CAST(inv.effective_from AS TIMESTAMPTZ)),
CAST(inv.effective_from AS TIMESTAMPTZ)
)
) AS updated_at
FROM (
SELECT
party_id,
customer_relationship_id,
entity_id,
effective_from
FROM olap.party_involvements_dm
WHERE
entity_type = 'ACCOUNT'
AND involvement_type = 'ACCOUNT_HOLDER'
AND status = 'ACTIVE'
AND disabled_at IS NULL
AND effective_from <= CURRENT_TIMESTAMP
AND (
effective_to IS NULL OR effective_to > CURRENT_TIMESTAMP
)
) AS inv
JOIN party.customer_relationships FOR SYSTEM_TIME AS OF PROCTIME() AS cr
ON cr.id = inv.customer_relationship_id
AND cr.type = 'CUSTOMER'
AND cr.status = 'ACTIVE'
AND cr.disabled_at IS NULL
GROUP BY
inv.party_id,
inv.entity_id