| Actor | Fragment | Worker | State |
|---|---|---|---|
| 742253 | 62464 | 51 | running |
| 742254 | 62464 | 51 | running |
| 742255 | 62465 | 51 | running |
| 742256 | 62465 | 51 | running |
| 742258 | 62467 | 51 | running |
| 742259 | 62467 | 51 | running |
| 742260 | 62466 | 51 | running |
| 742261 | 62466 | 51 | running |
| 742305 | 62468 | 51 | running |
| 742306 | 62468 | 51 | running |
| 742365 | 62470 | 51 | running |
| 742366 | 62470 | 51 | running |
CREATE MATERIALIZED VIEW insights.holding_values_raw_mv AS
SELECT
h.account_id,
h.asset_id,
h.dim_value_date,
h.type,
h.currency_code,
h.market_value,
h.average_cost_per_unit,
h.purchased_quantity,
h.average_cost_per_unit_system_currency,
h.total_cost_system_currency,
fd.profit_accrued AS deposit_profit_accrued
FROM olap.holding_values_raw_ft AS h
LEFT JOIN (
SELECT
fdh.account_id,
fdh.dim_value_date,
MIN(fdh.asset_id) AS asset_id,
MAX(fd_src.profit_accrued) AS profit_accrued
FROM olap.holding_values_raw_ft AS fdh
JOIN olap.fixed_deposit_accounts_ft AS fd_src
ON fd_src.account_id = fdh.account_id AND fd_src.fact_date = fdh.dim_value_date
WHERE
fdh.type = 'ASSET'
AND NOT fd_src.profit_accrued IS NULL
AND fd_src.disabled_at IS NULL
GROUP BY
fdh.account_id,
fdh.dim_value_date
) AS fd
ON fd.account_id = h.account_id
AND fd.dim_value_date = h.dim_value_date
AND fd.asset_id = h.asset_id
AND h.type = 'ASSET'