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 F177AD6DC for ; Sat, 13 Oct 2012 17:42:15 +0000 (UTC) Received: (qmail 5572 invoked by uid 500); 13 Oct 2012 17:42:13 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 5552 invoked by uid 500); 13 Oct 2012 17:42:13 -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 5542 invoked by uid 99); 13 Oct 2012 17:42:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Oct 2012 17:42:13 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ertiop93@gmail.com designates 209.85.160.44 as permitted sender) Received: from [209.85.160.44] (HELO mail-pb0-f44.google.com) (209.85.160.44) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Oct 2012 17:42:09 +0000 Received: by mail-pb0-f44.google.com with SMTP id ro8so3774303pbb.31 for ; Sat, 13 Oct 2012 10:41:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=vDNp6LspNTpHXOBDg/u3q6lSPqrE/k0wYtxLJTmgoGU=; b=sL0r5v9DgH0aq3j7S6R0vOhd75N15FkFVE5iK8FbcFh0Vdu/TBD90KaxJu284Tz0Vi F6C5t55mhNmYWLUYd38Qg23US2pUcB4wijuP/BVZiYkJT1HKskx1xx+XtScSNFBT5U9G j6/YwqAr6PoGAZg0kCdp7w0WPENoRMDBJ4QYKvvOEQaZOipLDNcBmbE/0SpWXN3uzqcf rbpegsSu4BEtoFn7EbPdQcTn0QFOxRmIinrK8MlLHteq0LMEp6rIISqnZfJ1ILUJau9h xwFgAhqfTePst6BlUOj/vUB8YgAenqi+G5SVU8nLP/BehzwIYunxnAW5O2p10EjQBwCu Q+VQ== MIME-Version: 1.0 Received: by 10.68.136.98 with SMTP id pz2mr2151390pbb.2.1350150108805; Sat, 13 Oct 2012 10:41:48 -0700 (PDT) Received: by 10.68.31.104 with HTTP; Sat, 13 Oct 2012 10:41:48 -0700 (PDT) In-Reply-To: References: Date: Sat, 13 Oct 2012 23:11:48 +0530 Message-ID: Subject: Re: Option for ordering columns by timestamp in CF From: Ertio Lew To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=047d7b15fcf9a0f8e104cbf45108 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b15fcf9a0f8e104cbf45108 Content-Type: text/plain; charset=ISO-8859-1 @B Todd Burruss: Regarding the use cases, I think they are pretty common. At least I see its usages very frequently in my project. Lets say when the application needs to store a timeline of bookmark activity by a user on certain items then if I could store the activity data containing columns(with concerned item id as column name) & get it ordered by timestamp then I could also fetch from that row whether or not a particular item was bookmarked by user. Ordering columns by time is a very common requirement in any application therefore if such a mechanism is provided by cassandra, it would be really useful & convenient to app developers. On Sat, Oct 13, 2012 at 8:50 PM, Martin Koch wrote: > One example could be to identify when a row was last updated. For example, > if I have a column family for storing users, the row key is a user ID and > the columns are values for that user, e.g. natural column names would be > "firstName", "lastName", "address", etc; column names don't naturally > include a date here. > > Sorting the coulmns by timestamp and picking the last would allow me to > know when the row was last modified. (I could manually maintain a 'last > modified' column as well, I know, but just coming up with a use case :). > > /Martin Koch > > > On Fri, Oct 12, 2012 at 11:39 PM, B. Todd Burruss wrote: > >> trying to think of a use case where you would want to order by >> timestamp, and also have unique column names for direct access. >> >> not really trying to challenge the use case, but you can get ordering >> by timestamp and still maintain a "name" for the column using >> composites. if the first component of the composite is a timestamp, >> then you can order on it. when retrieved you will could have a "name" >> in the second component .. and have dupes as long as the timestamp is >> unique (use TimeUUID) >> >> >> On Fri, Oct 12, 2012 at 7:20 AM, Derek Williams wrote: >> > You probably already know this but I'm pretty sure it wouldn't be a >> trivial >> > change, since to efficiently lookup a column by name requires the >> columns to >> > be ordered by name. A separate index would be needed in order to provide >> > lookup by column name if the row was sorted by timestamp (which is the >> way >> > Redis implements it's sorted set). >> > >> > >> > On Fri, Oct 12, 2012 at 12:13 AM, Ertio Lew wrote: >> >> >> >> "Make column timestamps optional"- kidding me, right ?:) I do >> understand >> >> that this wont be possible as then cassandra wont be able to >> distinguish the >> >> latest among several copies of same column. I dont mean that. I just >> want >> >> the while ordering the columns, Cassandra(in an optional mode per CF) >> should >> >> not look at column names(they will exist though but for retrieval >> purposes >> >> not for ordering) but instead Cassandra would order the columns by >> looking >> >> at the timestamp values(timestamps would exist!). So the change would >> be >> >> just to provide a mode in which cassandra, while ordering, uses >> timestamps >> >> instead of column names. >> >> >> >> >> >> On Fri, Oct 12, 2012 at 2:26 AM, Tyler Hobbs >> wrote: >> >>> >> >>> Without thinking too deeply about it, this is basically equivalent to >> >>> disabling timestamps for a column family and using timestamps for >> column >> >>> names, though in a very indirect (and potentially confusing) manner. >> So, if >> >>> you want to open a ticket, I would suggest framing it as "make column >> >>> timestamps optional". >> >>> >> >>> >> >>> On Wed, Oct 10, 2012 at 4:44 AM, Ertio Lew >> wrote: >> >>>> >> >>>> I think Cassandra should provide an configurable option on per column >> >>>> family basis to do columns sorting by time-stamp rather than column >> names. >> >>>> This would be really helpful to maintain time-sorted columns without >> using >> >>>> up the column name as time-stamps which might otherwise be used to >> store >> >>>> most relevant column names useful for retrievals. Very frequently we >> need to >> >>>> store data sorted in time order. Therefore I think this may be a very >> >>>> general requirement & not specific to just my use-case alone. >> >>>> >> >>>> Does it makes sense to create an issue for this ? >> >>>> >> >>>> >> >>>> >> >>>> >> >>>> On Fri, Mar 25, 2011 at 2:38 AM, aaron morton < >> aaron@thelastpickle.com> >> >>>> wrote: >> >>>>> >> >>>>> If you mean order by the column timestamp (as passed by the client) >> >>>>> that it not possible. >> >>>>> >> >>>>> Can you use your own timestamps as the column name and store them as >> >>>>> long values ? >> >>>>> >> >>>>> Aaron >> >>>>> >> >>>>> On 25 Mar 2011, at 09:30, Narendra Sharma wrote: >> >>>>> >> >>>>> > Cassandra 0.7.4 >> >>>>> > Column names in my CF are of type byte[] but I want to order >> columns >> >>>>> > by timestamp. What is the best way to achieve this? Does it make >> sense for >> >>>>> > Cassandra to support ordering of columns by timestamp as option >> for a column >> >>>>> > family irrespective of the column name type? >> >>>>> > >> >>>>> > Thanks, >> >>>>> > Naren >> >>>>> >> >>>> >> >>> >> >>> >> >>> >> >>> -- >> >>> Tyler Hobbs >> >>> DataStax >> >>> >> >> >> > >> > >> > >> > -- >> > Derek Williams >> > >> > > --047d7b15fcf9a0f8e104cbf45108 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable @B Todd Burruss:=A0
Regarding the use cases, I think they are pretty co= mmon. At least I see its usages very frequently in my project. Lets say whe= n the application needs to store a timeline of bookmark activity by a user = on certain items then if I could store the=A0activity data=A0containing=A0c= olumns(with concerned item id as column name) & get it ordered by times= tamp then I could also fetch from that row whether or not a particular item= was=A0bookmarked=A0by user.=A0
Ordering columns by time is a very common requirement in any applicati= on therefore if such a mechanism is provided by cassandra, it would be real= ly useful &=A0convenient to app developers.

On Sat, Oct 13, 2012 at 8:50 PM, Martin Koch <mak@issuu.com> wr= ote:
One example could be to identify when a row was last updated. For example, = if I have a column family for storing users, the row key is a user ID and t= he columns are values for that user, e.g. natural column names would be &qu= ot;firstName", "lastName", "address", etc; column = names don't naturally include a date here.=A0

Sorting the coulmns by timestamp and picking the last would = allow me to know when the row was last modified. (I could manually maintain= a 'last modified' column as well, I know, but just coming up with = a use case :).

/Martin Koch


On Fri, Oct 12, 2012 at 11:39 PM, B. Todd Burruss <btoddb@gmail.c= om> wrote:
trying to think of a use case where you woul= d want to order by
timestamp, and also have unique column names for direct access.

not really trying to challenge the use case, but you can get ordering
by timestamp and still maintain a "name" for the column using
composites. if the first component of the composite is a timestamp,
then you can order on it. =A0when retrieved you will could have a "nam= e"
in the second component .. and have dupes as long as the timestamp is
unique (use TimeUUID)


On Fri, Oct 12, 2012 at 7:20 AM, Derek Williams <derek@fyrie.net> wrote:
> You probably already know this but I'm pretty sure it wouldn't= be a trivial
> change, since to efficiently lookup a column by name requires the colu= mns to
> be ordered by name. A separate index would be needed in order to provi= de
> lookup by column name if the row was sorted by timestamp (which is the= way
> Redis implements it's sorted set).
>
>
> On Fri, Oct 12, 2012 at 12:13 AM, Ertio Lew <ertiop93@gmail.com> wrote:
>>
>> "Make column timestamps optional"- kidding me, right ?:)= =A0I do understand
>> that this wont be possible as then cassandra wont be able to disti= nguish the
>> latest among several copies of same column. I dont mean that. I ju= st want
>> the while ordering the columns, Cassandra(in an optional mode per = CF) should
>> not look at column names(they will exist though but for retrieval = purposes
>> not for ordering) but instead Cassandra would order the columns by= looking
>> at the timestamp values(timestamps would exist!). So the change wo= uld be
>> just to provide a mode in which cassandra, while ordering, uses ti= mestamps
>> instead of column names.
>>
>>
>> On Fri, Oct 12, 2012 at 2:26 AM, Tyler Hobbs <tyler@datastax.com> wrote: >>>
>>> Without thinking too deeply about it, this is basically equiva= lent to
>>> disabling timestamps for a column family and using timestamps = for column
>>> names, though in a very indirect (and potentially confusing) m= anner. =A0So, if
>>> you want to open a ticket, I would suggest framing it as "= ;make column
>>> timestamps optional".
>>>
>>>
>>> On Wed, Oct 10, 2012 at 4:44 AM, Ertio Lew <ertiop93@gmail.com> wrote:<= br> >>>>
>>>> I think Cassandra should provide an configurable option on= per column
>>>> family basis to do columns sorting by time-stamp rather th= an column names.
>>>> This would be really helpful to maintain time-sorted colum= ns without using
>>>> up the column name as time-stamps which might otherwise be= used to store
>>>> most relevant column names useful for retrievals. Very fre= quently we need to
>>>> store data sorted in time order. Therefore I think this ma= y be a very
>>>> general requirement & not specific to just my use-case= alone.
>>>>
>>>> Does it makes sense to create an issue for this ?
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, Mar 25, 2011 at 2:38 AM, aaron morton <aaron@thelastpickle.c= om>
>>>> wrote:
>>>>>
>>>>> If you mean order by the column timestamp (as passed b= y the client)
>>>>> that it not possible.
>>>>>
>>>>> Can you use your own timestamps as the column name and= store them as
>>>>> long values ?
>>>>>
>>>>> Aaron
>>>>>
>>>>> On 25 Mar 2011, at 09:30, Narendra Sharma wrote:
>>>>>
>>>>> > Cassandra 0.7.4
>>>>> > Column names in my CF are of type byte[] but I wa= nt to order columns
>>>>> > by timestamp. What is the best way to achieve thi= s? Does it make sense for
>>>>> > Cassandra to support ordering of columns by times= tamp as option for a column
>>>>> > family irrespective of the column name type?
>>>>> >
>>>>> > Thanks,
>>>>> > Naren
>>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Tyler Hobbs
>>> DataStax
>>>
>>
>
>
>
> --
> Derek Williams
>


--047d7b15fcf9a0f8e104cbf45108--