Skip to content
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

Improve query planning in StorageReadObjects #1132

Merged
merged 10 commits into from
Feb 29, 2024
Merged

Conversation

ftkg
Copy link
Contributor

@ftkg ftkg commented Nov 9, 2023

This aims to optimize queries for cases where all requested storage objects are for the same user/key/collection:

  1. For any requested column, if all requested values are the same then it becomes a simple WHERE $column = $value condition;
  2. If among all requested columns only one has multiple distinct values requested, it becomes a WHERE $column = ANY($values[]) condition;
  3. Otherwise, if we have two or three columns with multiple distinct values requested, these columns become part of a JOIN ROWS FROM () virtual table clause.

@ftkg ftkg requested a review from redbaron November 9, 2023 15:55
server/core_storage.go Outdated Show resolved Hide resolved
Copy link
Member

@sesposito sesposito left a comment

Choose a reason for hiding this comment

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

The changes look good but because this a critical code path I'd suggest we add some tests to cover the different built queries.

@ftkg ftkg merged commit 99ca235 into master Feb 29, 2024
3 checks passed
@ftkg ftkg deleted the ft-optimized-storage-read branch February 29, 2024 14:08
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.

None yet

3 participants