| Actor | Fragment | Worker | State |
|---|---|---|---|
| 741784 | 44415 | 51 | running |
| 741785 | 44415 | 51 | running |
| 741881 | 44410 | 51 | running |
| 741882 | 44410 | 51 | running |
| 741883 | 44409 | 51 | running |
| 741884 | 44409 | 51 | running |
| 741885 | 44411 | 51 | running |
| 741886 | 44411 | 51 | running |
| 741908 | 44412 | 51 | running |
| 741909 | 44412 | 51 | running |
| 741915 | 44413 | 51 | running |
| 741916 | 44413 | 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