RWM Console cluster: risingwave-adib.adib-rw.svc.cluster.local

← cluster insights objects holding_values_journal_density_mv
Overview Objects Graph History
materialized view · insights.holding_values_journal_density_mv Explain plan ▶
Parallelism
2
Actors
24 / 24
running
Distribution
HASH
Rows
23,829
State size
5.1 MiB
Created
2026-08-24 15:29
Initialized
2026-08-24 15:29
Fragment flags
MVIEWSNAPSHOT_BACKFILL_STREAM_SCANSTREAM_SCAN
Actors
ActorFragmentWorkerState
103013 23459 26 running
103014 23459 26 running
103015 23460 26 running
103016 23460 26 running
103017 23462 26 running
103018 23462 26 running
103019 23461 26 running
103020 23461 26 running
103021 23464 26 running
103022 23464 26 running
103023 23463 26 running
103024 23463 26 running
+ 12 more actor(s) (24 running)
sql · insights.holding_values_journal_density_mv — click to expand
CREATE MATERIALIZED VIEW insights.holding_values_journal_density_mv AS
WITH series_windows AS (
  SELECT
    account_id,
    asset_id,
    currency_code,
    dim_settlement_date,
    settled_quantity,
    LEAD(dim_settlement_date) OVER (PARTITION BY account_id, asset_id, currency_code ORDER BY dim_settlement_date) AS next_settlement_date
  FROM insights.settled_position_series_mv AS settled_position_series_mv_next
), price_month_spine AS (
  SELECT DISTINCT
    asset_id,
    CAST(DATE_TRUNC('MONTH', date) AS DATE) AS dim_value_month
  FROM asset_service.asset_prices_eod_ft AS asset_prices_eod_ft_next
  WHERE
    NOT reference_price IS NULL
), series_binned AS (
  SELECT
    s.account_id,
    s.asset_id,
    s.currency_code,
    s.dim_settlement_date,
    s.settled_quantity,
    s.next_settlement_date,
    spine.dim_value_month
  FROM series_windows AS s
  JOIN price_month_spine AS spine
    ON spine.asset_id = s.asset_id
    AND spine.dim_value_month >= CAST(DATE_TRUNC('MONTH', s.dim_settlement_date) AS DATE)
    AND (
      s.next_settlement_date IS NULL OR spine.dim_value_month <= s.next_settlement_date
    )
)
SELECT
  s.account_id,
  s.asset_id,
  px.date AS dim_value_date,
  CAST('ASSET' AS VARCHAR) AS type,
  s.currency_code,
  s.settled_quantity * px.reference_price AS market_value,
  cb.average_cost_per_unit,
  cb.average_cost_per_unit_system_currency,
  cb.total_cost_system_currency,
  cb.cost_fx_provenance,
  s.settled_quantity AS purchased_quantity
FROM series_binned AS s
JOIN (
  SELECT
    asset_id,
    date,
    reference_price,
    CAST(DATE_TRUNC('MONTH', date) AS DATE) AS dim_value_month
  FROM asset_service.asset_prices_eod_ft AS asset_prices_eod_ft_next
  WHERE
    NOT reference_price IS NULL
) AS px
  ON px.asset_id = s.asset_id
  AND px.dim_value_month = s.dim_value_month
  AND px.date >= s.dim_settlement_date
  AND (
    s.next_settlement_date IS NULL OR px.date < s.next_settlement_date
  )
LEFT JOIN insights.settled_cost_basis_series_mv AS cb
  ON cb.account_id = s.account_id
  AND cb.asset_id = s.asset_id
  AND cb.currency_code = s.currency_code
  AND cb.effective_from <= px.date
  AND (
    cb.effective_to IS NULL OR px.date < cb.effective_to
  )
Lineage · insights.holding_values_journal_density_mv 5 objects
Direct (1-hop) dependencies from rw_depend, across schemas. Click a neighbor to expand its dependencies; ⌘/Ctrl-click opens its page. Drag to pan, scroll to zoom. External source/sink endpoints (Kafka, Iceberg) are not shown.