2

Can't find any info about redis scan match

does it mean that if I have 500,000 keys it will iterate over all of them one by one and check if they match the pattern? or it have some other clever trick to pull only relevance keys?

if its actually scan them all, is it performance wisely?

THanks

Amir Bar
  • 3,007
  • 2
  • 29
  • 47

1 Answers1

3

Scan is basically an alternate to keys command which is blocking. It will return a cursor and with that cursor you need to scan again and the process continues. Duplicates are also possible so you need to handle them in the app logic which means even if you have only 1 million keys and you scan for 10,000 items in each scan it can go more than 10 times.

So it's actually a trade off instead of using keys which is a blocking command but quick you can use scan which is actually slow in comparison with keys command but will not block in the production environment and still achieves what you need.

Hope this helps

Karthikeyan Gopall
  • 5,469
  • 2
  • 19
  • 35
  • 3
    tnx but I am more interest about the scan match option and not the difference between key and scan :) – Amir Bar Sep 01 '16 at 18:15