Database Reference
In-Depth Information
Outbound follows
We'll start with the question, "Who do I follow?" We'll want a partition per user, with each
partition containing all the other users they follow:
CREATE TABLE "user_outbound_follows" (
"follower_username" text,
"followed_username" text,
PRIMARY KEY ("follower_username", "followed_username")
);
Simple enough, but there's something unusual here: there are only two columns in the
table, and they're both part of the primary key. As it turns out, this is a perfectly valid way
to construct a table schema; non-key columns are optional in Cassandra tables. Since all we
need to know is who's at the other end of the follow relationship, which is available via the
clustering column followed_user_id , no additional data columns are needed.
Search WWH ::




Custom Search