Skip to content

Any guidance when/what to use partitions for, vs key prefixes? #80

Closed Answered by marvin-j97
jamesmunns asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

I bet the answer is "it depends on your access patterns".

That's for sure, so I can't give you definitive answer of what's best.

I'm not sure where to draw the lines of "when to use key prefixes in the same partition", or "when to use separate partitions", particularly when the partitions might be "dynamic"

You can think of a single partition as a single database table/index in a RDBMS (the table itself being just the primary index).

Personally here, I would create 3 partitions:

  • dev: {device_id} => metadata struct
  • dev_log: {device_id}/{uuidv7} => log
  • dev_msg: {device_id}/{msg_kind}/{uuidv7} => msg

That way you also don't have to specify /logs/ or /metadata/ in the key. Shorter k…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@jamesmunns
Comment options

@marvin-j97
Comment options

@marvin-j97
Comment options

Answer selected by marvin-j97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants