Runs VACUUM and ANALYZE to reclaim space and update query planner statistics.
(&self)
| 228 | |
| 229 | /// Runs VACUUM and ANALYZE to reclaim space and update query planner statistics. |
| 230 | pub async fn optimize(&self) -> Result<()> { |
| 231 | self.conn |
| 232 | .execute_batch("VACUUM; ANALYZE;") |
| 233 | .await |
| 234 | .map_err(|e| TraceDecayError::Database { |
| 235 | message: format!("failed to optimize database: {e}"), |
| 236 | operation: "optimize".to_string(), |
| 237 | })?; |
| 238 | Ok(()) |
| 239 | } |
| 240 | |
| 241 | /// Returns the on-disk size of the database file in bytes. |
| 242 | pub async fn size(&self) -> Result<u64> { |
no outgoing calls