Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions crates/persisting-pchronicle-cli/src/server/acceleration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,16 @@ async fn bounded_summary_jsonl(
max_rows: u64,
max_bytes: usize,
) -> Result<String> {
if tracing::enabled!(target: "pchronicle.query", tracing::Level::DEBUG) {
match engine.query_jsonl(&format!("EXPLAIN {sql}")).await {
Ok(plan) => {
tracing::debug!(target: "pchronicle.query", sql = %sql, plan = %plan, "summary query plan")
}
Err(error) => {
tracing::debug!(target: "pchronicle.query", sql = %sql, error = %error, "summary query plan unavailable")
}
}
}
let mut output = super::BoundedOutput::new(max_bytes);
let result = engine
.write_query_jsonl_with_max_rows(sql, &mut output, Some(max_rows))
Expand All @@ -1087,6 +1097,13 @@ async fn bounded_summary_jsonl(
"run summary byte budget exhausted; narrow the dataset or source scope"
);
result.context("stream run summary within its row budget")?;
tracing::debug!(
target: "pchronicle.query",
sql = %sql,
rows = output.bytes.iter().filter(|byte| **byte == b'\n').count(),
bytes = output.bytes.len(),
"summary query completed"
);
String::from_utf8(output.bytes).context("decode run summary JSONL")
}

Expand Down
Loading
Loading