spicysaltysquid
spicysaltysquid

Reputation: 13

Is it inefficient to use blobs as primary keys?

I need to use 256-bit hashes as primary keys in some of my Cassandra tables. Which CQL data type should I use to represent these?

Right now I'm using 'blob', but is there any efficiency concerns with doing so?

Upvotes: 1

Views: 786

Answers (1)

ashic
ashic

Reputation: 6495

Cassandra does a straight up comparison at the end of the day. The only issue you'd have here is the 32 byte primary key. If space isn't an issue, there shouldn't be much of a problem. One thing to keep in mind is that if you're using a key cache, you'll have 32 bytes per key. That said, it's not uncommon to have composite partition keys with strings in them that represent natural keys. As such, I wouldn't be too worried.

Upvotes: 1

Related Questions