Skip to content

Add slow query parse logging#972

Merged
levkk merged 4 commits into
pgdogdev:mainfrom
frodsan:log-slow-query-parsing
May 15, 2026
Merged

Add slow query parse logging#972
levkk merged 4 commits into
pgdogdev:mainfrom
frodsan:log-slow-query-parsing

Conversation

@frodsan
Copy link
Copy Markdown
Contributor

@frodsan frodsan commented May 11, 2026

  • Adds log_min_duration_parse (ms) config option: when set, emits a WARN log for any query whose parse time meets or exceeds the threshold.
  • Adds log_query_sample_length (default: 1000) to cap how many characters of the query are included in the log line, keeping logs readable for long queries.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 11, 2026

CLA assistant check
All committers have signed the CLA.

@frodsan frodsan marked this pull request as ready for review May 11, 2026 13:11
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

❌ Patch coverage is 88.00000% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pgdog/src/frontend/router/parser/cache/ast.rs 25.00% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment thread pgdog/src/backend/pool/cluster.rs Outdated
Comment thread pgdog/src/backend/pool/cluster.rs Outdated
Comment thread pgdog/src/frontend/router/parser/cache/ast.rs Outdated
@levkk
Copy link
Copy Markdown
Collaborator

levkk commented May 14, 2026

One small type change and also don't forget to run cargo fmt.

To fix the jsonschema error, run cargo run --bin pgdog-jsonschema and commit the diff (.json change).

Comment thread pgdog/src/frontend/router/parser/cache/context.rs Outdated
@frodsan
Copy link
Copy Markdown
Contributor Author

frodsan commented May 15, 2026

@levkk thanks for the review! I fixed the comments in 4052ea5 and f916d57 😄

should we add a default to log_min_duration_parse to enable this feature by default? 🤔

@frodsan frodsan requested a review from levkk May 15, 2026 14:04
Copy link
Copy Markdown
Collaborator

@levkk levkk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, thank you.

@levkk levkk merged commit 8c64508 into pgdogdev:main May 15, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants