RWM Console cluster: risingwave.platform.svc.cluster.local

← cluster insights objects settled_cost_basis_carried_mv
Overview Objects Graph History
materialized view · insights.settled_cost_basis_carried_mv Explain plan ▶
Parallelism
2
Actors
8 / 8
running
Distribution
HASH
Rows
5,356
State size
732.8 KiB
Created
2026-07-30 11:04
Initialized
2026-07-30 11:04
Fragment flags
MVIEWSNAPSHOT_BACKFILL_STREAM_SCANSTREAM_SCAN
Actors
ActorFragmentWorkerState
33107 9916 33 running
33108 9916 33 running
33109 9915 33 running
33110 9915 33 running
33111 9918 33 running
33112 9918 33 running
33153 9917 33 running
33154 9917 33 running
sql · insights.settled_cost_basis_carried_mv — click to expand
CREATE MATERIALIZED VIEW insights.settled_cost_basis_carried_mv AS
WITH real_groups AS (
  SELECT
    account_id,
    asset_id,
    type,
    currency_code,
    dim_value_date,
    average_cost_per_unit,
    average_cost_per_unit_system_currency,
    total_cost_system_currency,
    cost_fx_provenance,
    purchased_quantity,
    m_is_stub,
    SUM(CASE WHEN NOT m_is_stub IS TRUE THEN 1 ELSE 0 END) OVER (
      PARTITION BY account_id, asset_id, currency_code
      ORDER BY dim_value_date
      ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
    ) AS real_group
  FROM insights.settled_cost_basis_dedup_mv
)
SELECT
  account_id,
  asset_id,
  type,
  currency_code,
  dim_value_date,
  average_cost_per_unit,
  CASE
    WHEN m_is_stub IS TRUE
    THEN MAX(
      CASE
        WHEN NOT m_is_stub IS TRUE
        THEN average_cost_per_unit_system_currency
        ELSE NULL
      END
    ) OVER (PARTITION BY account_id, asset_id, currency_code, real_group)
    ELSE average_cost_per_unit_system_currency
  END AS average_cost_per_unit_system_currency,
  CASE
    WHEN m_is_stub IS TRUE
    THEN MAX(CASE WHEN NOT m_is_stub IS TRUE THEN total_cost_system_currency ELSE NULL END) OVER (PARTITION BY account_id, asset_id, currency_code, real_group)
    ELSE total_cost_system_currency
  END AS total_cost_system_currency,
  CASE
    WHEN m_is_stub IS TRUE
    THEN MAX(CASE WHEN NOT m_is_stub IS TRUE THEN cost_fx_provenance ELSE NULL END) OVER (PARTITION BY account_id, asset_id, currency_code, real_group)
    ELSE cost_fx_provenance
  END AS cost_fx_provenance,
  purchased_quantity,
  m_is_stub
FROM real_groups
Lineage · insights.settled_cost_basis_carried_mv 4 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.