Skip to content

Instantly share code, notes, and snippets.

@dln
Created October 15, 2010 09:22
Show Gist options
  • Save dln/627895 to your computer and use it in GitHub Desktop.
Save dln/627895 to your computer and use it in GitHub Desktop.
First revision (Secondary Index)
==================================
Store objects in one CF, and index in another.
Note: In Cassandra 0.7, using a secondary index for columns id:google, id:fb, id:myspace would eliminate the need for UserIndex.
Users
------
"e0ee3406d83c11dfa47e002219990fd7": {
"name": "Joe User",
"email": "[email protected]",
...
"id:google": "[email protected]",
"id:fb": "joeuser",
"id:myspace"": "omgjoe",
...
}
UserTransactions (CompareBy=TimeUUID)
-----------------------------------------
"e0ee3406d83c11dfa47e002219990fd7": {
"40459394-d83e-11df-aacd-002219990fd7": "DATADATADATADATADATA"
"59af962c-d83e-11df-ad2e-002219990fd7": "ATADATADATADATADATAD"
"59d55c22-d83e-11df-924a-002219990fd7": "TADATADATADATADATADAT"
"59eb3736-d83e-11df-b53e-002219990fd7": "ADATADATADATADATADATA"
...
}
UserIndex (Could be replaced with sec. idx in 0.7)
-----------------------------------------------------
"google:[email protected]": {
"UUID": "e0ee3406d83c11dfa47e002219990fd7"
},
"fb:joeuser": {
"UUID": "e0ee3406d83c11dfa47e002219990fd7"
},
"myspace:omgjoe": {
"UUID": "e0ee3406d83c11dfa47e002219990fd7"
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment