-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Optimize vector/payload reads in large query batches, defer reads #6276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4047618
to
7ecd085
Compare
📝 WalkthroughWalkthroughThe changes modify query handling in the Suggested reviewers
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
lib/collection/src/collection/query.rs (2)
33-35
: Consider making the threshold configurable.
Allowing this threshold to be adjusted dynamically (e.g., via configuration or environment variables) could be beneficial to avoid redeploying just for changing it.
208-281
: Improve handling of partial metadata requirements.
Currently, the two-step search is triggered only if all requests in the batch require payloads and vectors. For large mixed-batch queries where only some requests need payloads or vectors, consider applying the two-step approach to those specific requests only. This finer-grained strategy could yield better performance for batches with diverse metadata needs.lib/collection/src/collection/search.rs (2)
67-71
: Consider partial metadata logic.
The code checks if all searches require payloads or vectors before enabling the two-step flow. For mixed queries (some with and some without payload/vector), a more selective approach could optimize large or varied requests.
94-99
: Selective replacement approach.
Usingreplace()
forwith_payload
andwith_vector
clarifies the intention to set them tofalse
. If partial results are needed, a more targeted replacement strategy might better serve mixed queries.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
lib/collection/src/collection/query.rs
(4 hunks)lib/collection/src/collection/search.rs
(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (11)
- GitHub Check: Basic TLS/HTTPS tests
- GitHub Check: test-snapshot-operations-s3-minio
- GitHub Check: test-shard-snapshot-api-s3-minio
- GitHub Check: test-low-resources
- GitHub Check: test (macos-latest)
- GitHub Check: test-consensus-compose
- GitHub Check: test (windows-latest)
- GitHub Check: test-consensus
- GitHub Check: test (ubuntu-latest)
- GitHub Check: test
- GitHub Check: test
🔇 Additional comments (4)
lib/collection/src/collection/query.rs (1)
12-12
: No concerns regarding the new imports.
The additional import statements look appropriate for the introduced functionality.lib/collection/src/collection/search.rs (3)
22-22
: Conditional compilation looks fine.
Restricting this method to the “testing” feature flag poses no obvious issues.
83-85
: Shared threshold reference.
Referencing the threshold fromquery.rs
promotes consistency across the codebase.
118-118
: Straightforward zip usage.
Zipping the results with the original requests is a concise way to pair up final data.
Implements this which we have in search, also for our query API.
If having a large number of shards or a large offset, prevent transferring a huge amount of payloads across the network within the cluster. Instead, defer reading vectors and payloads to a second step to greatly improve search performance.
All Submissions:
dev
branch. Did you create your branch fromdev
?New Feature Submissions:
cargo +nightly fmt --all
command prior to submission?cargo clippy --all --all-features
command?