Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 23697 invoked from network); 15 Jun 2010 10:07:22 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Jun 2010 10:07:22 -0000 Received: (qmail 15952 invoked by uid 500); 15 Jun 2010 10:07:21 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 15750 invoked by uid 500); 15 Jun 2010 10:07:19 -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 15742 invoked by uid 99); 15 Jun 2010 10:07:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jun 2010 10:07:18 +0000 X-ASF-Spam-Status: No, hits=0.8 required=10.0 tests=AWL,SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of sylvain@yakaz.com does not designate 209.85.161.44 as permitted sender) Received: from [209.85.161.44] (HELO mail-fx0-f44.google.com) (209.85.161.44) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jun 2010 10:07:11 +0000 Received: by fxm13 with SMTP id 13so3221590fxm.31 for ; Tue, 15 Jun 2010 03:06:50 -0700 (PDT) Received: by 10.223.21.17 with SMTP id h17mr6842939fab.45.1276596410251; Tue, 15 Jun 2010 03:06:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.118.147 with HTTP; Tue, 15 Jun 2010 03:06:30 -0700 (PDT) In-Reply-To: References: From: Sylvain Lebresne Date: Tue, 15 Jun 2010 12:06:30 +0200 Message-ID: Subject: Re: How to get previous / next data? To: user@cassandra.apache.org Cc: bram.vanderwaaij@tno.nl Content-Type: text/plain; charset=ISO-8859-1 You want to use 'reversed' in SliceRange (and a start with whatever you want and a count of 2). -- Sylvain On Tue, Jun 15, 2010 at 12:01 PM, Bram van der Waaij wrote: > Hello, > > We want to use cassandra to store and retrieve time related data. Storing > the time-value pairs is easy and works perfectly. The problem arrives at > retrieving the data. We do not only want to retrieve data from within a time > range, but also be able to get the previous and/or next data sample from a > specific point in time. > > The next in time i can retrieve by giving asking for the range > timestamp...maxtime and request for 2 items. Which returns timestamp (if > available) and the next timestamp-value. > > Does anybody know how i can retrieve the previous timestamp? The columns are > sorted on the key(timestamp), so the previous request/next should not be a > difficult to perform. > > Any suggestions are welcome! > > Thanks, > > Bram van der Waaij