| Actor | Fragment | Worker | State |
|---|---|---|---|
| 737989 | 52505 | 51 | running |
| 737990 | 52505 | 51 | running |
| 737991 | 52506 | 51 | running |
| 737992 | 52506 | 51 | running |
| 737993 | 52508 | 51 | running |
| 737994 | 52508 | 51 | running |
| 737995 | 52507 | 51 | running |
| 737996 | 52507 | 51 | running |
| 737997 | 52509 | 51 | running |
| 737998 | 52509 | 51 | running |
| 737999 | 52512 | 51 | running |
| 738000 | 52512 | 51 | running |
CREATE MATERIALIZED VIEW alinma_bff.party_advisor_kpi_user_accounts_mv AS
SELECT
user_accounts.user_id,
user_accounts.account_id,
MAX(user_accounts.updated_at) AS updated_at
FROM (
SELECT
uc.user_id,
pcm.account_id,
uc.updated_at
FROM alinma_bff.party_advisor_kpi_user_customers_mv AS uc
JOIN alinma_bff.party_current_account_membership_mv AS pcm
ON pcm.party_id = uc.party_id
AND pcm.customer_relationship_id = uc.customer_relationship_id
AND pcm.account_group_type = 'all'
UNION ALL
SELECT
up.user_id,
atp.account_id,
up.updated_at
FROM alinma_bff.party_advisor_kpi_direct_user_portfolios_mv AS up
JOIN olap.account_to_portfolios_dm AS atp
ON atp.portfolio_id = up.portfolio_id
AND atp.disabled_at IS NULL
AND atp.effective_end_date IS NULL
JOIN olap.accounts_dm AS a
ON a.account_id = atp.account_id AND a.closing_date IS NULL AND a.disabled_at IS NULL
) AS user_accounts
GROUP BY
user_accounts.user_id,
user_accounts.account_id