Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CE57E10FE9 for ; Wed, 10 Jul 2013 06:52:01 +0000 (UTC) Received: (qmail 28291 invoked by uid 500); 10 Jul 2013 06:51:59 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 28258 invoked by uid 500); 10 Jul 2013 06:51:56 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 28250 invoked by uid 99); 10 Jul 2013 06:51:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jul 2013 06:51:55 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of y2klyf@gmail.com designates 209.85.215.41 as permitted sender) Received: from [209.85.215.41] (HELO mail-la0-f41.google.com) (209.85.215.41) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jul 2013 06:51:48 +0000 Received: by mail-la0-f41.google.com with SMTP id fn20so5468130lab.0 for ; Tue, 09 Jul 2013 23:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=xe3vyaS5GIufHCZLX319o6kFj7Gtok4VyRV6BLXUNsw=; b=dSUjUwGFdlhtUfbqVXO4rp4211xezyHjnXus33D2S48ookCLpfYoqat8nlPkW1yllz qZ2QCqAE95Osim+DTSwuJtJR0562Qt5MrYjYG9pcSJ37CgV4QmKvJJIRRt95gJimQiUp /t5Ah13PPVxQiwbyzfSNo4hYGRCbaVqAjXvB+VltCTvqBRb2oHb4LIe/tsDItNExcfre AsLID0kEsohtoabNMKL8uEfr4hMiXno3y1E68kyrLjOlmKZGjqIoGN7HF6VRnCOQSnbC 63vKlZDTVEPH2LQ3Qqvxpc1yMLJNhke2CyW3yJSJ/axvdFfkQANlapVZDEfHySgtLR2D LDMA== MIME-Version: 1.0 X-Received: by 10.152.8.72 with SMTP id p8mr14567416laa.70.1373439088173; Tue, 09 Jul 2013 23:51:28 -0700 (PDT) Sender: y2klyf@gmail.com Received: by 10.114.66.15 with HTTP; Tue, 9 Jul 2013 23:51:28 -0700 (PDT) Date: Tue, 9 Jul 2013 23:51:28 -0700 X-Google-Sender-Auth: 8yakurmqzV1-f3ShqIDsxnmsfkw Message-ID: Subject: data model question : finding out the n most recent changes items From: Jimmy Lin To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=001a11c365b8f8a8c804e122b49d X-Virus-Checked: Checked by ClamAV on apache.org --001a11c365b8f8a8c804e122b49d Content-Type: text/plain; charset=ISO-8859-1 I have an application that need to find out the n most recent modified files for a given user id. I started out few tables but still couldn't get what i want, I hope someone get point to some right direction... See my tables below. #1 won't work, because file_id's timeuuid contains creation time, not the modification time. #2 won't work, because i can't order by a non primary key column(modified_date) #3,#4 although i can now get a time series of modification time of each file belongs to a user, my return list may still not accurate because a single directory could have lot of modification changes. I basically end up pulling out series of modification timestamp for the same directory. Any suggestion? Thanks #1 CREATE TABLE user_file ( user_id uuid, file_id timeuuid, PRIMARY KEY(user_id, file_id) ); #2 CREATE TABLE user_file ( user_id uuid, file_id timeuuid, modified_date timestamp, PRIMARY KEY(user_id, file_id) ); #3 CREATE TABLE user_file ( user_id uuid, file_id timeuuid, modified_date timestamp, PRIMARY KEY(user_id, file_id, modified_date) ); #4 CREATE TABLE user_file ( user_id uuid, modified_date timestamp, file_id timeuuid, PRIMARY KEY(user_id, modified_date, file_id) ); --001a11c365b8f8a8c804e122b49d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

I have an application that need to find out the n most = recent modified files for a given user id. I started out few tables but sti= ll couldn't get what i want, I hope someone get point to some right dir= ection...

See my tables below.

#1 won'= t work, because file_id's timeuuid contains creation time, not the modi= fication time.

#2 won't work, because i can'= t order by a non primary key column(modified_date)

#3,#4 although i can now get =A0a time series of mo= dification time of each file belongs to a user, my return list may still no= t accurate because a single directory could have lot of modification change= s. I basically end up pulling out series of modification timestamp for the = same directory.

Any suggestion?

Thanks


#1

CREATE TABLE = user_file (

user_id uuid,

file_id=A0timeuuid,

PRIMARY KEY(user_id, file_id)

);


#2

CREATE TABLE user_file (

user_id = uuid,

file_id=A0t= imeuuid,

modified_date timestamp,

PRIMARY KEY(user_id, file_id)

);


#3

CREATE TABLE user_file (

user_id uuid,

file_id=A0timeuuid,

modified_d= ate timestamp,

PRIMARY KEY(user_id= , file_id, modified_date)

);


#4

CREATE TABLE user_file (

user_id = uuid,

modified_date timestamp,

file_id=A0timeuuid,

PRIMARY KEY(user_id, modified_date, f= ile_id)

);



--001a11c365b8f8a8c804e122b49d--