RWM Console cluster: risingwave.platform.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
18 / 18
running
Distribution
HASH
Rows
688,433
State size
68.3 MiB
Created
2026-08-25 14:38
Initialized
2026-08-25 14:38
Fragment flags
MVIEWSNAPSHOT_BACKFILL_STREAM_SCANSTREAM_SCAN
Actors
ActorFragmentWorkerState
33289 12216 33 running
33290 12216 33 running
33291 12218 33 running
33292 12218 33 running
33293 12219 33 running
33294 12219 33 running
33295 12220 33 running
33296 12220 33 running
33297 12221 33 running
33298 12221 33 running
33315 12213 33 running
33316 12213 33 running
+ 6 more actor(s) (18 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
), 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.