| Actor | Fragment | Worker | State |
|---|---|---|---|
| 736744 | 51840 | 51 | running |
| 736745 | 51840 | 51 | running |
| 736746 | 51842 | 51 | running |
| 736747 | 51842 | 51 | running |
| 736748 | 51841 | 51 | running |
| 736749 | 51841 | 51 | running |
| 736820 | 51843 | 51 | running |
| 736821 | 51843 | 51 | running |
| 736822 | 51844 | 51 | running |
| 736823 | 51844 | 51 | running |
| 736824 | 51845 | 51 | running |
| 736825 | 51845 | 51 | running |
CREATE MATERIALIZED VIEW alinma_bff.account_owners_mv AS
SELECT
atc.account_id,
JSONB_AGG(
JSONB_BUILD_OBJECT(
'id',
c.id,
'displayName',
c.display_name,
'localDisplayName',
c.local_display_name,
'preferredName',
c.preferred_name,
'ownerType',
atc.owner_type
)
) AS owners,
CAST(COUNT(*) AS INT) AS owner_count
FROM olap.accounts_to_clients_dm AS atc
JOIN olap.clients_dm AS c
ON c.id = atc.client_id AND c.closing_date IS NULL
JOIN insights.open_accounts_mv AS oa
ON oa.account_id = atc.account_id
WHERE
atc.disabled_at IS NULL AND atc.effective_end_date IS NULL
GROUP BY
atc.account_id