Skip to content

Conversation

@michaeljmarshall
Copy link
Member

@michaeljmarshall michaeljmarshall commented Nov 6, 2025

What is the issue

Fixes: https://github.com/riptano/cndb/issues/15919
Test PR: https://github.com/riptano/cndb/pull/15949

What does this PR fix and why was it fixed

In the original implementation for #820, we introduced the PrimaryKeyMapIterator to iterate all primary keys in an sstable and then do an anti-join on the result of an equality query. That design works, but requires some additional reads from disk to get primary keys that are unnecessary. We can instead iterate over the segment row ids and do the anti join (or the complement) of the result posting list for each segment. In doing so, we avoid several reads from disk and subsequent comparisons.

We will see the largest benefit for low cardinality queries that select then negate many rows because we will skip loading many primary keys. We will also see a benefit when there are clustering columns because we can skip loading larger keys.

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

Checklist before you submit for review

  • This PR adheres to the Definition of Done
  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits
  • All new files should contain the DataStax copyright header instead of the Apache License one

@michaeljmarshall michaeljmarshall marked this pull request as ready for review November 7, 2025 04:12
@sonarqubecloud
Copy link

@cassci-bot
Copy link

✔️ Build ds-cassandra-pr-gate/PR-2112 approved by Butler


Approved by Butler
See build details here

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