| Actor | Fragment | Worker | State |
|---|---|---|---|
| 739224 | 58793 | 51 | running |
| 739225 | 58793 | 51 | running |
| 739226 | 58794 | 51 | running |
| 739227 | 58794 | 51 | running |
| 739228 | 58795 | 51 | running |
| 739229 | 58795 | 51 | running |
| 739230 | 58796 | 51 | running |
| 739231 | 58796 | 51 | running |
| 739232 | 58797 | 51 | running |
| 739233 | 58797 | 51 | running |
| 739252 | 58799 | 51 | running |
| 739253 | 58799 | 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'