| Actor | Fragment | Worker | State |
|---|---|---|---|
| 745822 | 64248 | 51 | running |
| 745823 | 64248 | 51 | running |
| 745966 | 64246 | 51 | running |
| 745967 | 64246 | 51 | running |
| 747302 | 64241 | 51 | running |
| 747303 | 64241 | 51 | running |
| 747304 | 64240 | 51 | running |
| 747305 | 64240 | 51 | running |
| 747306 | 64242 | 51 | running |
| 747307 | 64242 | 51 | running |
| 747308 | 64243 | 51 | running |
| 747309 | 64243 | 51 | 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'