| Actor | Fragment | Worker | State |
|---|---|---|---|
| 166203 | 19966 | 33 | running |
| 166204 | 19966 | 33 | running |
| 166205 | 19961 | 33 | running |
| 166206 | 19961 | 33 | running |
| 166207 | 19964 | 33 | running |
| 166208 | 19964 | 33 | running |
| 166209 | 19967 | 33 | running |
| 166210 | 19969 | 33 | running |
| 166211 | 19969 | 33 | running |
| 166212 | 19959 | 33 | running |
| 166213 | 19959 | 33 | running |
| 166214 | 19963 | 33 | running |
CREATE MATERIALIZED VIEW opportunity.account_balance_delta_mv AS
SELECT
oa.account_id,
b.dim_balance_date,
b.currency_code,
b.market_value,
prev.market_value AS prev_market_value
FROM insights.position_summary_mv AS b
JOIN insights.position_summary_mv AS prev
ON prev.account_group_id = b.account_group_id
AND prev.position_type = b.position_type
AND prev.currency_code = b.currency_code
AND prev.dim_balance_date = b.dim_balance_date - 1
JOIN insights.open_accounts_mv AS oa
ON b.account_group_id = 'account_group_' || MD5(CAST((
oa.account_id || 'all'
) AS BYTEA))
JOIN olap.product_types_dm AS pt
ON pt.product_type_id = oa.product_type_id
WHERE
b.source_entity_type = 'account'
AND b.position_type = 'POSITION'
AND pt.type = 'INVESTMENT'
AND prev.market_value > 0
AND CAST(b.dim_balance_date AS TIMESTAMPTZ) >= CURRENT_TIMESTAMP - INTERVAL '30 DAYS'