I currently have a scenario where we are using REDIS to store string field-value
pairs within a hashed set HSET
.
The original reasoning behind using hashed sets instead of just sets is ease of retrieving the records using HSCAN
inside a GUI Search Bar as opposed to just SCAN
because it's easier to get the length of a hash to use in the COUNT
field.
I read in the Redis documentation that both GET
and HGET
commands execute with O(1) time complexity, but a member of my team thinks that if I store all the values inside a single key then it basically returns the entire hash during HGET
instead of the singular field-value
that I need.
So for a made up but similar example:
- I have a Redis instance with a single Hashed Set called
users
. - The hashed set has 150,000
field:value
pairs ofusername:email
If when I execute hget users coolguy
, is the entire hash getting returned or just the email for user coolguy
?