Get cached query plan
(
&self,
query_hash: u64,
optimization_level: &str,
hints: Vec<String>,
)
| 272 | |
| 273 | /// Get cached query plan |
| 274 | pub fn get_query_plan( |
| 275 | &self, |
| 276 | query_hash: u64, |
| 277 | optimization_level: &str, |
| 278 | hints: Vec<String>, |
| 279 | ) -> Option<PlanCacheEntry> { |
| 280 | if !self.config.enabled { |
| 281 | return None; |
| 282 | } |
| 283 | |
| 284 | let schema_version = *self.schema_version.read().unwrap(); |
| 285 | let key = create_plan_cache_key( |
| 286 | query_hash, |
| 287 | schema_version, |
| 288 | optimization_level, |
| 289 | hints.clone(), |
| 290 | ); |
| 291 | |
| 292 | if let Some(plan_entry) = self.plan_cache.get(&key) { |
| 293 | self.record_event(CacheEvent::PlanCacheHit { |
| 294 | key, |
| 295 | saved_time_ms: plan_entry.compilation_time.as_millis() as u64, |
| 296 | timestamp: Instant::now(), |
| 297 | }); |
| 298 | Some(plan_entry) |
| 299 | } else { |
| 300 | self.record_event(CacheEvent::PlanCacheMiss { |
| 301 | key, |
| 302 | timestamp: Instant::now(), |
| 303 | }); |
| 304 | None |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | /// Cache compiled query plan |
| 309 | pub fn cache_query_plan( |
nothing calls this directly
no test coverage detected