RWM Console cluster: risingwave-adib.adib-rw.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
10 / 10
running
Distribution
HASH
Rows
123,241
State size
23.4 MiB
Created
2026-07-17 21:17
Initialized
2026-07-17 21:17
Fragment flags
MVIEWSNAPSHOT_BACKFILL_STREAM_SCANSTREAM_SCAN
Actors
ActorFragmentWorkerState
99872 16958 26 running
99873 16958 26 running
99874 16957 26 running
99875 16957 26 running
99876 16961 26 running
99877 16961 26 running
99878 16959 26 running
99879 16959 26 running
99882 16960 26 running
99883 16960 26 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 AS settled_cost_basis_dedup_mv_next
)
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.