| Actor | Fragment | Worker | State |
|---|---|---|---|
| 53583 | 2898 | 3 | running |
| 53584 | 2898 | 3 | running |
| 53585 | 2905 | 3 | running |
| 53586 | 2905 | 3 | running |
| 53589 | 2897 | 3 | running |
| 53590 | 2897 | 3 | running |
| 53593 | 2902 | 3 | running |
| 53594 | 2902 | 3 | running |
| 54800 | 2894 | 3 | running |
| 54801 | 2894 | 3 | running |
| 54802 | 2895 | 3 | running |
| 54803 | 2895 | 3 | running |
CREATE MATERIALIZED VIEW adib_rm.party_cash_tiles_mv
WITH (
backfill_order=FIXED(olap.currencies_dm -> insights.party_account_direct_mv)
) AS
SELECT
pad.party_id,
JSONB_AGG(
JSONB_BUILD_OBJECT(
'accountId',
a.account_id,
'name',
a.name,
'number',
a.number,
'value',
JSONB_BUILD_OBJECT(
'amount',
CAST(iabs.available_balance AS VARCHAR),
'currency',
JSONB_BUILD_OBJECT('code', a.base_currency_code, 'symbol', cur.symbol)
),
'baseCurrency',
JSONB_BUILD_OBJECT('code', a.base_currency_code, 'symbol', cur.symbol)
)
) AS cash_tiles
FROM insights.party_account_direct_mv AS pad
JOIN adib_rm.accounts_plain_mv AS a
ON a.account_id = pad.account_id
LEFT JOIN olap.currencies_dm FOR SYSTEM_TIME AS OF PROCTIME() AS cur
ON cur.code = a.base_currency_code
LEFT JOIN adib_rm.investment_account_balance_snapshot_mv AS iabs
ON iabs.account_id = a.account_id
WHERE
pad.type = 'all'
AND pad.effective_start_date <= CURRENT_TIMESTAMP
AND (
pad.effective_end_date IS NULL OR pad.effective_end_date > CURRENT_TIMESTAMP
)
AND a.product_type_id IN (
ID_FROM_STRING_WITH_PREFIX('product_type', 'INVESTMENT'),
ID_FROM_STRING_WITH_PREFIX('product_type', 'INVESTMENT_CASH')
)
GROUP BY
pad.party_id