Format the trace in a graph-optimized format
(&self)
| 137 | impl PlanTrace { |
| 138 | /// Format the trace in a graph-optimized format |
| 139 | pub fn format_graph_plan(&self) -> String { |
| 140 | let mut output = String::new(); |
| 141 | |
| 142 | // Header with summary |
| 143 | output.push_str("Query Plan Summary\n"); |
| 144 | output.push_str(&"=".repeat(50)); |
| 145 | output.push('\n'); |
| 146 | output.push_str(&format!( |
| 147 | "Total Cost: {:.1} | Estimated Rows: {} | Planning Time: {:.1}ms\n\n", |
| 148 | self.physical_plan.estimated_cost, |
| 149 | self.physical_plan.estimated_rows, |
| 150 | self.total_duration.as_secs_f64() * 1000.0 |
| 151 | )); |
| 152 | |
| 153 | // Execution plan tree |
| 154 | output.push_str("Execution Plan\n"); |
| 155 | output.push_str(&"=".repeat(50)); |
| 156 | output.push('\n'); |
| 157 | |
| 158 | self.format_plan_node(&self.physical_plan.root, &mut output, 0, true); |
| 159 | |
| 160 | // Planning steps summary |
| 161 | if !self.steps.is_empty() { |
| 162 | output.push_str("\nPlanning Steps\n"); |
| 163 | output.push_str(&"-".repeat(30)); |
| 164 | output.push('\n'); |
| 165 | for (i, step) in self.steps.iter().enumerate() { |
| 166 | output.push_str(&format!( |
| 167 | "{}. {} ({:.1}ms)\n", |
| 168 | i + 1, |
| 169 | step.description, |
| 170 | step.duration.as_secs_f64() * 1000.0 |
| 171 | )); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | output |
| 176 | } |
| 177 | |
| 178 | /// Format a single plan node with tree structure |
| 179 | fn format_plan_node( |
nothing calls this directly
no test coverage detected