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
13,056
State size
2.3 MiB
Created
2026-07-28 11:29
Initialized
2026-07-28 11:29
Fragment flags
MVIEWSNAPSHOT_BACKFILL_STREAM_SCANSTREAM_SCAN
Actors
ActorFragmentWorkerState
98817 19093 26 running
98818 19093 26 running
98819 19094 26 running
98820 19094 26 running
98821 19095 26 running
98822 19095 26 running
98823 19097 26 running
98824 19097 26 running
98825 19096 26 running
98826 19096 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.