Skip to content

Optimize KEYS when pattern includes hashtag and implies a single slot.#12754

Merged
oranagra merged 5 commits intoredis:unstablefrom
CharlesChen888:keys-hashtag
Dec 5, 2023
Merged

Optimize KEYS when pattern includes hashtag and implies a single slot.#12754
oranagra merged 5 commits intoredis:unstablefrom
CharlesChen888:keys-hashtag

Conversation

@CharlesChen888
Copy link
Contributor

@CharlesChen888 CharlesChen888 commented Nov 13, 2023

in #12536 we made a similar optimization for SCAN, now that hashtags in patterns. When we can make sure all keys matching the pettern will be in the same slot, we can limit the iteration to run only one one.

@CharlesChen888 CharlesChen888 changed the title Optimize KEYS Optimize KEYS when pattern includes hashtag and implies a single slot. Nov 13, 2023
Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

If we have this for SCAN, then I agree it makes sense for KEYS too.

@soloestoy soloestoy added the release-notes indication that this issue needs to be mentioned in the release notes label Nov 16, 2023
Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

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

conceptually approving this.
core-team needs to decide if / how this should be documented.

@oranagra oranagra added the approval-needed Waiting for core team approval to be merged label Nov 16, 2023
@oranagra
Copy link
Member

@redis/core-team as discussed in the meeting, please approve this one.
@CharlesChen888 or @zuiderkwast can you make a redis-doc PR to document all these changes (SCAN, KEYS, SORT)?

@CharlesChen888
Copy link
Contributor Author

dbIteratorInitFromSlot was deleted in another merged PR but was used here. I rebased and rewrite some of the code to avoid using that function.

@oranagra @zuiderkwast please review again

@oranagra oranagra merged commit 991aff1 into redis:unstable Dec 5, 2023
soloestoy pushed a commit that referenced this pull request Dec 7, 2023
If not in cluster mode, there is no need to compute slot.

A bit optimization for #12754
zuiderkwast added a commit to redis/redis-doc that referenced this pull request Jan 18, 2024
Adding to the cluster spec documentation of the following Redis features:

redis/redis#12754 (SCAN)
redis/redis#12536 (KEYS)
redis/redis#12728 (SORT, SORT_RO)
zuiderkwast pushed a commit to redis/redis-doc that referenced this pull request Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval-needed Waiting for core team approval to be merged release-notes indication that this issue needs to be mentioned in the release notes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants