XGROUP-SETID(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’… XGROUP-SETID (from the Valkey Command Manual, bestie)

okay so real talk, this is the page for xgroup-setid in the 3valkey manual β€” the command that goes "hey consumer group, forget where you were, this is your last-delivered ID now." slay.


✨ NAME ✨

xgroup-setid β€” Sets the last-delivered ID of a consumer group. that's it, that's the job πŸŽ€


✨ SYNOPSIS ✨

XGROUP SETID key group <id | $> [ENTRIESREAD entries-read]

look at her. so simple. so powerful. πŸ‘‘


✨ DESCRIPTION ✨

So like, this command sets the last delivered ID for a consumer group. periodt.

Normally your consumer group's last delivered ID gets locked in at the moment the group is born, aka when you make it with XGROUP CREATE. But XGROUP SETID lets you modify that last delivered ID whenever you want β€” no deleting and recreating the whole group, no dramatic breakup, none of that. πŸ’–

Classic scenario, iykyk: you want every consumer in the group to re-process all the messages in a stream. Then you'd set the next ID to 0, like this:

XGROUP SETID mystream mygroup 0

boom. everyone's back at the start. it's giving ✨fresh start era✨.

Now the optional entries_read argument β€” this one's the little sparkle on top ✨. You can pass it to turn on consumer group lag tracking for an arbitrary ID. And what counts as arbitrary, you ask? It's any ID that isn't the ID of the stream's first entry, isn't its last entry, and isn't the zero (0-0) ID. so basically the ones that don't already have a vibe of their own.

When is this useful?? When you know exactly how many entries sit between that arbitrary ID (not counting the ID itself, okay, excluding it) and the stream's last entry. In that case you can set entries_read to the stream's entries_added minus the number of entries. math girlies rise 🧚


✨ REPLY ✨

valkey-protocol(7) Simple string reply: OK.

just OK. she's low maintenance. πŸ’…


✨ COMPLEXITY ✨

O(1) β€” constant time, no thoughts, no stress, iconic behaviour only πŸ‘‘


✨ ACL CATEGORIES ✨

@slow @stream @write


✨ HISTORY ✨

  • Available since: 5.0.0 πŸŽ€
  • Changed in 7.0.0: Added the optional entries_read argument.

✨ SEE ALSO ✨

your required reading bestie, go off:


okay that's the whole page bestie, go set some IDs πŸ’– this was Valkey version 9.0.0, dated 2025-10-21 β€” catch you on the next manpage, mwah 🫢🌸

πŸ“¦ where this page comes from