In Redis, the ZCOUNT
command returns the number of elements in a sorted set with a score between two given values.
Tag: what is
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 readingRedis ZRANGE Command Explained
In Redis, the ZRANGE
command returns the specified range of elements in the sorted set stored at the specified key.
It can perform different types of range queries: by index (rank), by the score, or by lexicographical order.
Continue readingRedis ZADD Command Explained
In Redis, the ZADD
command is used to add one or more members to a sorted set, or to update the score for members that already exist in the sorted set.
It returns the number of elements added to the sorted set, or the number of elements updated if the CH
argument is used.
How to Return Data from Modified Rows in PostgreSQL
In PostgreSQL, we can use the RETURNING
clause to return data that was modified during an UPDATE
, INSERT
, or DELETE
operation. This allows us to see the data that was modified without having to perform a separate query to retrieve that data.
PostgreSQL DATE_BIN() Function Explained
In PostgreSQL, the DATE_BIN()
function enables us to “bin” a timestamp into a given interval aligned with a specific origin. In other words, we can use this function to map (or force) a timestamp to the nearest specified interval.
This can be handy when we want to truncate a timestamp to a given interval, for example a 10 minute interval. We can specify the interval (e.g. 10 minutes, 15 minutes, 30 minutes, etc), and we can specify the starting point for the interval. Therefore, we can have the interval starting at any odd time we want (it doesn’t need to start on the hour or anything like that).
Continue readingRedis HINCRBYFLOAT Command
The Redis HINCRBYFLOAT
command increments the field in the hash at the specified key by a floating point number. We specify how much we want the field to increment by when we call the command.
Redis HINCRBY Command
The Redis HINCRBY
command increments the number that’s stored at the specified field in the hash at the specified key. We specify how much we want the field to increment by when we call the command.