You could build a secondary index, e.g.

Articles : {
article_id1 : {}
article_id2 : {}

WebsiteArticle : {
website_id1 : { time_uuid : article_id1, time_uuid2 : article_id2}

when you want to get the last 10 for a website, get_slice from the WebsiteArticle CF then multi get from Articles.

Am assuming RP. There are some recommendations on the number of cols per key, in the millions I think I can never find it when I want it.

You could try a key of "webstie_id.timestamp" and try a get range using the Random Partitioner. The results will be unordered, but thats OK so long as you get the ones you want.


On 16 Jul, 2010,at 09:08 AM, S Ahmed <> wrote:

Given a CF like:

Articles : {
   key1 : { title:"some title", body: "this is my article body...", .... },
   key1 : { title:"some title", body: "this is my article body...", .... }

Now these articles could be for different websites e.g.,

If I want to get the latest 10 articles for a given website, how would I formulate my key to achieve this?

I basically need to understand how to handle multi-tenancy, b/c I will need to do this for almost all my CF's. 

I'm a little stuck here so guidance would be great!

On Thu, Jul 15, 2010 at 4:01 PM, S Ahmed <> wrote:

Ah, thanks for clarifying that.

key sorting is changing in .7 I believe to support a binary array?

On Thu, Jul 15, 2010 at 3:26 PM, Benjamin Black <> wrote:
Keys are always sorted (in 0.6) as UTF8 strings.  The CompareWith
applies to _columns_ within rows, _not_ to row keys.

On Wed, Jul 14, 2010 at 1:44 PM, S Ahmed <> wrote:
> Where is the link that describes the various key types and their impact on
> sorting? (I believe I read it before, can't seem to find it now).
> So my application supports multi-tenants, so I need the keys to represent
> things like:
> website1123 + contentID
> or
> website3454 + userID
> And for range queries, these keys have to be grouped together obviously.
> What key type would be best suited for this?
> I might have to create a CF that maps the website and its key prefix?