RWM Console cluster: risingwave-ai-hub-int.ai-hub-rwm.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
32 / 32
running
Distribution
HASH
Rows
40,517
State size
7.6 MiB
Created
2026-08-25 12:31
Initialized
2026-08-25 12:30
Fragment flags
LOCALITY_PROVIDERMVIEWSNAPSHOT_BACKFILL_STREAM_SCANSTREAM_SCAN
Actors
ActorFragmentWorkerState
164462 19477 33 running
164463 19477 33 running
164464 19478 33 running
164465 19478 33 running
164466 19475 33 running
164467 19475 33 running
164468 19479 33 running
164469 19479 33 running
164470 19466 33 running
164471 19466 33 running
164472 19471 33 running
164473 19471 33 running
+ 20 more actor(s) (32 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
  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
  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.