| Actor | Fragment | Worker | State |
|---|---|---|---|
| 157694 | 12713 | 33 | running |
| 157695 | 12713 | 33 | running |
| 157696 | 12711 | 33 | running |
| 157697 | 12711 | 33 | running |
| 157698 | 12712 | 33 | running |
| 157699 | 12712 | 33 | running |
| 157700 | 12714 | 33 | running |
| 157701 | 12714 | 33 | running |
| 157702 | 12715 | 33 | running |
| 157703 | 12715 | 33 | running |
| 157704 | 12716 | 33 | running |
| 157705 | 12716 | 33 | running |
CREATE MATERIALIZED VIEW alpheya_experience_bff.account_portfolios_mv
WITH (
backfill_order=FIXED(olap.portfolios_dm -> olap.account_to_portfolios_dm)
) AS
SELECT
atp.account_id,
JSONB_AGG(JSONB_BUILD_OBJECT('id', p.portfolio_id, 'name', p.name, 'number', p.number)) AS portfolios,
CAST(COUNT(*) AS INT) AS portfolio_count
FROM olap.account_to_portfolios_dm AS atp
JOIN olap.portfolios_dm AS p
ON p.portfolio_id = atp.portfolio_id AND p.disabled_at IS NULL
JOIN insights.open_accounts_mv AS oa
ON oa.account_id = atp.account_id
WHERE
atp.disabled_at IS NULL AND atp.effective_end_date IS NULL
GROUP BY
atp.account_id