| Actor | Fragment | Worker | State |
|---|---|---|---|
| 157746 | 17878 | 33 | running |
| 157747 | 17878 | 33 | running |
| 157778 | 17881 | 33 | running |
| 157779 | 17881 | 33 | running |
| 157780 | 17889 | 33 | running |
| 157781 | 17889 | 33 | running |
| 157782 | 17880 | 33 | running |
| 157783 | 17880 | 33 | running |
| 157784 | 17879 | 33 | running |
| 157785 | 17879 | 33 | running |
| 157786 | 17882 | 33 | running |
| 157787 | 17882 | 33 | running |
CREATE MATERIALIZED VIEW insights.party_account_direct_mv AS
SELECT
inv.party_id,
inv.customer_relationship_id,
inv.entity_id AS account_id,
inv.effective_from AS effective_start_date,
inv.effective_to AS effective_end_date,
CAST('all' AS VARCHAR) AS type
FROM olap.party_involvements_dm AS inv
JOIN insights.open_accounts_mv AS oa
ON oa.account_id = inv.entity_id
JOIN party.customer_relationships AS cr
ON cr.id = inv.customer_relationship_id
AND cr.type = 'CUSTOMER'
AND cr.status = 'ACTIVE'
AND cr.disabled_at IS NULL
WHERE
inv.entity_type = 'ACCOUNT'
AND inv.involvement_type IN ('ACCOUNT_HOLDER', 'JOINT_ACCOUNT_HOLDER')
AND inv.status = 'ACTIVE'
AND inv.disabled_at IS NULL
AND (
inv.effective_to IS NULL OR inv.effective_to > inv.effective_from
)
UNION ALL
SELECT
inv.party_id,
inv.customer_relationship_id,
inv.entity_id AS account_id,
inv.effective_from AS effective_start_date,
inv.effective_to AS effective_end_date,
CAST(CASE WHEN oa.is_restricted THEN 'restricted' ELSE 'un_restricted' END AS VARCHAR) AS type
FROM olap.party_involvements_dm AS inv
JOIN insights.open_accounts_mv AS oa
ON oa.account_id = inv.entity_id
JOIN party.customer_relationships AS cr
ON cr.id = inv.customer_relationship_id
AND cr.type = 'CUSTOMER'
AND cr.status = 'ACTIVE'
AND cr.disabled_at IS NULL
WHERE
inv.entity_type = 'ACCOUNT'
AND inv.involvement_type IN ('ACCOUNT_HOLDER', 'JOINT_ACCOUNT_HOLDER')
AND inv.status = 'ACTIVE'
AND inv.disabled_at IS NULL
AND (
inv.effective_to IS NULL OR inv.effective_to > inv.effective_from
)