RWM Console cluster: risingwave-alinma.alinma-rw.svc.cluster.local

← cluster opportunity objects portfolio_allocation_drift_breaches_mv
Overview Objects Graph History
materialized view · opportunity.portfolio_allocation_drift_breaches_mv Explain plan ▶
Parallelism
2
Actors
39 / 39
running
Distribution
HASH
Rows
4,961
State size
4.8 KiB
Created
2026-08-19 23:11
Initialized
2026-08-19 23:11
Fragment flags
LOCALITY_PROVIDERMVIEWNOWSNAPSHOT_BACKFILL_STREAM_SCANSTREAM_SCAN
Actors
ActorFragmentWorkerState
740807 62006 51 running
740808 62006 51 running
740809 62007 51 running
740810 62007 51 running
740811 62008 51 running
740812 62008 51 running
740813 62009 51 running
740814 62009 51 running
740815 62010 51 running
740816 62010 51 running
740817 62011 51 running
740818 62011 51 running
+ 27 more actor(s) (39 running)
sql · opportunity.portfolio_allocation_drift_breaches_mv — click to expand
CREATE MATERIALIZED VIEW opportunity.portfolio_allocation_drift_breaches_mv AS
WITH drift_metrics AS (
  SELECT
    pag.portfolio_id AS resource_id,
    p.dim_balance_date,
    p.taxonomy_node_id,
    p.weight AS current_allocation,
    b.weight AS benchmark_allocation,
    (
      p.weight - b.weight
    ) AS drift_percentage,
    'GET_PORTFOLIO_ALLOCATION_DRIFT_PERCENTAGE' AS activity_name
  FROM insights.position_by_distribution_mv AS p
  JOIN insights.portfolio_to_account_groups_mv AS pag
    ON pag.account_group_id = p.account_group_id AND pag.type = 'all'
  JOIN olap.portfolios_dm AS pd
    ON pd.portfolio_id = pag.portfolio_id
  JOIN insights.benchmark_values_by_distribution_mv AS b
    ON b.benchmark_id = pd.benchmark_id
    AND b.fact_date = p.dim_balance_date
    AND b.distribution_type = p.distribution_type
    AND b.taxonomy_node_id = p.taxonomy_node_id
  WHERE
    p.distribution_type = 'asset_classes'
    AND p.source_entity_type = 'portfolio'
    AND p.position_type = 'POSITION'
    AND CAST(p.dim_balance_date AS TIMESTAMPTZ) >= CURRENT_TIMESTAMP - INTERVAL '30 DAYS'
)
SELECT
  c.opportunity_id,
  m.resource_id,
  m.dim_balance_date AS fact_date,
  m.taxonomy_node_id,
  m.current_allocation,
  m.benchmark_allocation,
  m.drift_percentage
FROM drift_metrics AS m
JOIN opportunity.opportunity_conditions_mv AS c
  ON c.activity_name = m.activity_name
WHERE
  CASE c.op
    WHEN 'GTE'
    THEN m.drift_percentage >= c.threshold
    WHEN 'GT'
    THEN m.drift_percentage > c.threshold
    WHEN 'LTE'
    THEN m.drift_percentage <= c.threshold
    WHEN 'LT'
    THEN m.drift_percentage < c.threshold
    WHEN 'EQ'
    THEN m.drift_percentage = c.threshold
    ELSE FALSE
  END
Lineage · opportunity.portfolio_allocation_drift_breaches_mv 8 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.