Skip to content

feat: Remove query comments to improve cache hit rate#775

Open
dev-lew wants to merge 1 commit intopgdogdev:mainfrom
dev-lew:dev-lew/remove-query-comments
Open

feat: Remove query comments to improve cache hit rate#775
dev-lew wants to merge 1 commit intopgdogdev:mainfrom
dev-lew:dev-lew/remove-query-comments

Conversation

@dev-lew
Copy link

@dev-lew dev-lew commented Feb 18, 2026

This PR addresses #560

It modifies the comment function (now parse_comment), which will capture a role and shard and then return the original query string with all comments removed except for those that match 0 or more regexes.

If there is a cache miss, we do another cache lookup after removing comments except for those used for pgdog metadata (pgdog_shard, etc) in the hope that we can increase cache hit rate.

Two associated helper functions were added as well.

Also, some tests were modified to reflect the new functionality.

@dev-lew dev-lew marked this pull request as ready for review February 18, 2026 20:09
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 94.76744% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...dog/src/frontend/router/parser/cache/cache_impl.rs 78.26% 5 Missing ⚠️
pgdog/src/frontend/router/parser/comment.rs 96.72% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant

Comments