SINTERSTORE(3valkey)
π SINTERSTORE π
okay bestie, welcome to the sinterstore page from the Valkey Command Manual, section 3valkey. she's a set-ops girlie and she's about to store some vibes, not just show them off. β¨
πΈ NAME πΈ
sinterstore β Stores the intersect of multiple sets in a key.
like, it finds the overlap and then keeps it. main character energy fr. π
π SYNOPSIS π
SINTERSTORE destination key [key...]
π¦ DESCRIPTION π¦
okay so here's the tea: this command is equal to SINTER, except instead of just returning the resulting set to you like a lil show-off, it stores it in destination. the results get written down. committed. periodt. π
and if destination already exists? it gets overwritten. no warning, no mercy, she just replaces whatever was there. ngl that's kind of iconic of her but also watch out. π
π REPLY π
valkey-protocol(7) Integer reply: the number of elements in the resulting set.
so you get back a lil number telling you how many besties made it into the intersection. π«Ά
π COMPLEXITY π
O(N*M) worst case, where N is the cardinality of the smallest set and M is the number of sets.
translation: she finds the smallest set and uses it as the starting point, which is lowkey smart of her. π
β ACL CATEGORIES β
@set@slow@write
π§ HISTORY π§
- Available since:
1.0.0β she's an OG, been here since the very beginning. π
π EXAMPLES π
watch her cook π₯:
127.0.0.1:6379> SADD key1 "a"
(integer) 1
127.0.0.1:6379> SADD key1 "b"
(integer) 1
127.0.0.1:6379> SADD key1 "c"
(integer) 1
127.0.0.1:6379> SADD key2 "c"
(integer) 1
127.0.0.1:6379> SADD key2 "d"
(integer) 1
127.0.0.1:6379> SADD key2 "e"
(integer) 1
127.0.0.1:6379> SINTERSTORE key key1 key2
(integer) 1
127.0.0.1:6379> SMEMBERS key
1) "c"
so key1 is a, b, c and key2 is c, d, e. the only one they have in common? "c". and boom, key now holds exactly that one lil legend. the reply is (integer) 1 because one element made it through. slay. π
π SEE ALSO π
sadd(3valkey)scard(3valkey)sdiff(3valkey)sdiffstore(3valkey)sinter(3valkey)sintercard(3valkey)sismember(3valkey)smembers(3valkey)smismember(3valkey)smove(3valkey)spop(3valkey)srandmember(3valkey)srem(3valkey)sscan(3valkey)sunion(3valkey)sunionstore(3valkey)
okay that's the whole page bestie, you're officially a SINTERSTORE expert now, no cap π
β¨
this lil masterpiece is from Valkey version 9.0.0, dated 2025-10-21. go forth and intersect, queen. ππ¦
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms