RWM Console cluster: risingwave-ai-hub-int.ai-hub-rwm.svc.cluster.local

← cluster insights objects settled_cost_basis_series_mv
Overview Objects Graph History
materialized view · insights.settled_cost_basis_series_mv Explain plan ▶
Parallelism
2
Actors
4 / 4
running
Distribution
HASH
Rows
1,155
State size
191.3 KiB
Created
2026-08-25 12:29
Initialized
2026-08-25 12:29
Fragment flags
LOCALITY_PROVIDERMVIEWSNAPSHOT_BACKFILL_STREAM_SCANSTREAM_SCAN
Actors
ActorFragmentWorkerState
164378 19450 33 running
164379 19450 33 running
164380 19451 33 running
164381 19451 33 running
sql · insights.settled_cost_basis_series_mv — click to expand
CREATE MATERIALIZED VIEW insights.settled_cost_basis_series_mv AS
WITH changes AS (
  SELECT
    account_id,
    asset_id,
    type,
    currency_code,
    dim_value_date AS effective_from,
    average_cost_per_unit,
    average_cost_per_unit_system_currency,
    total_cost_system_currency,
    cost_fx_provenance,
    purchased_quantity,
    m_is_stub
  FROM (
    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,
      LAG(average_cost_per_unit) OVER (PARTITION BY account_id, asset_id, currency_code ORDER BY dim_value_date) AS prev_cost,
      LAG(average_cost_per_unit_system_currency) OVER (PARTITION BY account_id, asset_id, currency_code ORDER BY dim_value_date) AS prev_cost_system_currency,
      LAG(total_cost_system_currency) OVER (PARTITION BY account_id, asset_id, currency_code ORDER BY dim_value_date) AS prev_total_cost_system_currency,
      LAG(cost_fx_provenance) OVER (PARTITION BY account_id, asset_id, currency_code ORDER BY dim_value_date) AS prev_cost_fx_provenance
    FROM insights.settled_cost_basis_carried_mv
  ) AS c
  WHERE
    (
      prev_cost IS DISTINCT FROM average_cost_per_unit
    )
    OR (
      prev_cost_system_currency IS DISTINCT FROM average_cost_per_unit_system_currency
    )
    OR (
      prev_total_cost_system_currency IS DISTINCT FROM total_cost_system_currency
    )
    OR (
      prev_cost_fx_provenance IS DISTINCT FROM cost_fx_provenance
    )
)
SELECT
  account_id,
  asset_id,
  type,
  currency_code,
  effective_from,
  LEAD(effective_from) OVER (PARTITION BY account_id, asset_id, currency_code ORDER BY effective_from) AS effective_to,
  average_cost_per_unit,
  average_cost_per_unit_system_currency,
  total_cost_system_currency,
  cost_fx_provenance,
  purchased_quantity,
  m_is_stub
FROM changes
Lineage · insights.settled_cost_basis_series_mv 3 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.