Maybe i'm a bit late to the party, but that can be still useful for
reference in future.
We've tried to keep documentation for Clojure cassandra driver as elaborate
and generic as possible, and it contains raw CQL examples,
so you can refer to the docs even if you're using any other driver.
Here'
You could just separate the history data from the current data. Then
when the user's result is updated, just write into two tables.
CREATE TABLE all_answers (
user_id uuid,
created timeuuid,
result text,
question_id varint,
PRIMARY KEY (user_id, created)
)
CREATE TABLE current_answers (
Yes, that makes sense and that article helped a lot, but I still have a few
questions...
The created_at in our answers table is basically used as a version id.
When a user updates his answer, we don't overwrite the old answer, but
rather insert a new answer with a more recent timestamp (the versi
So, if you want to grab by the created_at and occasionally limit by
question id, that is why you'd use created_at.
The way the primary keys work is the first part of the primary key is the
Partioner key, that field is what essentially is the single cassandra row.
The second key is the order prese
Interesting, thank you for the reply.
Two questions though...
Why should created_at come before question_id in the primary key? In other
words, why (user_id, created_at, question_id) instead of (user_id,
question_id, created_at)?
Given this setup, all a user's answers (all 10k) will be stored i
I think you'd just be better served with just a little different primary
key.
If your primary key was (user_id, created_at) or (user_id, created_at,
question_id), then you'd be able to run the above query without a problem.
This will mean that the entire pantheon of a specific user_id will be
st
Hello,
We are considering using Cassandra and I want to make sure our use case
fits Cassandra's strengths. We have the table like:
answers
---
user_id | question_id | result | created_at
Where our most common query will be something like:
SELECT * FROM answers WHERE user_id = 123 AND creat