From d80814fa2c41b48342f358692866c28a51acb5dd Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Fri, 12 Sep 2025 07:21:16 +0300 Subject: [PATCH] core/schema: Optimize get_dependent_materialized_views() when no views Eliminates get_dependent_materialized_views() overhead when there are no views. Note that we need to optimize the case when there are views as well because this ends up being pretty hot in write-intensive workloads. --- core/schema.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/schema.rs b/core/schema.rs index 99e81ebe0..4bec53ad0 100644 --- a/core/schema.rs +++ b/core/schema.rs @@ -178,6 +178,9 @@ impl Schema { /// Get all materialized views that depend on a given table pub fn get_dependent_materialized_views(&self, table_name: &str) -> Vec { + if self.table_to_materialized_views.is_empty() { + return Vec::new(); + } let table_name = normalize_ident(table_name); self.table_to_materialized_views .get(&table_name)