CNDB-18512: Add metrics about fetched/returned cells to the slow query logger - #2564
Open
adelapena wants to merge 1 commit into
Open
CNDB-18512: Add metrics about fetched/returned cells to the slow query logger#2564adelapena wants to merge 1 commit into
adelapena wants to merge 1 commit into
Conversation
Checklist before you submit for review
|
adelapena
force-pushed
the
CNDB-18512-main
branch
from
August 13, 2026 10:41
32ffdcd to
6617128
Compare
|
❌ Build ds-cassandra-pr-gate/PR-2564 rejected by Butler3 regressions found Found 3 new test failures
Found 4 known test failures |
pkolaczk
approved these changes
Aug 20, 2026
pkolaczk
left a comment
There was a problem hiding this comment.
Looks awesome!
One minor thing: can you add some tests of user defined types?
Would a user defined type with 3 fields count as one cell or as 3 cells?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




What is the issue
The slow query logger shows counts the number of fetched/returned partitions/rows/tombstones. However, it doesn't say the number of fetched/returned cells, nor cell tombstones. This is problematic for incidents where we see slow queries and all query metrics look normal despite of having massive rows.
What does this PR fix and why was it fixed
It adds the number of fetched and returned cells to the log reports produced for slow queries. This is done for both SAI and regular queries.
Differently to the counts of partitions and rows, there are no separate counts of live and deleted cells. This is because having separate counts of live/deleted cells would require to iterate the b-tree of cells checking timestamps or every returned row of every query. Benchmarking has proven that that has a significative impact on performance, so we should probably limit this to just counting cells regardless of liveness info.
This is how the log reports for regular queries would look like:
The SAI log reports would look like:
Here are some runs of the included JMH benchmarks, showing that the current approach doesn't seem to have a noticeable impact of performance:
ReadCommandExecutionInfoBenchwith this patch:ReadCommandExecutionInfoBenchon main branch:QueryMonitorableExecutionInfoBenchwith this patch:QueryMonitorableExecutionInfoBenchon main branch: