In Redis, the ZINTER
command returns the intersection of the specified sorted sets. In other words, it returns only those members that are present in all sorted sets.
Category: DBMS
Database Management Systems
Fix “WRONGTYPE Operation against a key holding the wrong kind of value” when using LRANGE in Redis
If you get an error that reads “WRONGTYPE Operation against a key holding the wrong kind of value” when using the LRANGE
command, it’s probably because you’re passing a key with the wrong data type.
To fix this issue, be sure that the key you pass to the LRANGE
command holds a list.
Redis ZDIFFSTORE Command Explained
In Redis, the ZDIFFSTORE
command computes the difference between the first and all successive input sorted sets and stores the result in the specified key.
ZDIFFSTORE
works in the same way as the ZDIFF
command, except that it stores the result instead of returning it (ZDIFF
returns the result instead of storing it in a new key).
Redis ZDIFF Command Explained
In Redis, the ZDIFF
command returns the difference between the first and all successive input sorted sets.
Redis ZCOUNT Command Explained
In Redis, the ZCOUNT
command returns the number of elements in a sorted set with a score between two given values.
Redis ZREVRANK Command Explained
In Redis, the ZREVRANK
command returns the rank of the specified element of a sorted set ordered in descending order (from high to low).
If we want the set to be in ascending order, we can use the ZRANK
command.
Redis ZRANK Command Explained
In Redis, the ZRANK
command returns the rank of the specified element of a sorted set.
The scores are ordered from low to high. If we want them in the opposite order, we can use the ZREVRANK
command.
Redis ZRANDMEMBER Command Explained
In Redis, the ZRANDMEMBER
command enables us to get one or more random elements from a sorted set.
We can specify whether or not to return only distinct elements or to allow duplicates. We can also specify whether or not to include the scores of each element in the result.
Continue readingGet All Parameters from a SQL Server Database (T-SQL)
In SQL Server we can query the sys.parameters
system catalog view to return all parameters that belong to user-defined objects.
For system objects, we can query the sys.system_parameters
view. We can alternatively query the sys.all_parameters
system catalog view to return all parameters that belong to either user-defined or system objects.
Redis ZRANGEBYSCORE Replacement
Starting with Redis 6.2.0, the ZRANGE
command added the REV
, BYSCORE
, BYLEX
and LIMIT
options. The addition of the first three options means that the ZRANGE
command can now do what the ZREVRANGE
, ZRANGEBYSCORE
, ZREVRANGEBYSCORE
, ZRANGEBYLEX
and ZREVRANGEBYLEX
commands can do.
As a result, those commands are now deprecated (as of Redis 6.2.0).
Therefore, we should no longer use the ZRANGEBYSCORE
command when we need to return a sorted set by score. Instead, we should use the ZRANGE
command with the BYSCORE
argument.