Re: DataModelling to query date range

2016-03-24 Thread Vidur Malik
Hi Chris, I had something slightly different in mind. You would treat it as time series data, and have one record for each of the days the route was valid. In your case: start | end| valid New York Washington 2016-01-01 New York Washington 2016-01-02 New York

RE: DataModelling to query date range

2016-03-24 Thread Peer, Oded
init.co.uk] Sent: Thursday, March 24, 2016 9:40 AM To: user@cassandra.apache.org Subject: Re: DataModelling to query date range Ah- that looks interesting! I'm actaully still on cassandra 2.x but I was planning on updgrading anyway. Once I do so I'll check this one out. Chris On T

Re: DataModelling to query date range

2016-03-24 Thread Chris Martin
Ah- that looks interesting! I'm actaully still on cassandra 2.x but I was planning on updgrading anyway. Once I do so I'll check this one out. Chris On Thu, Mar 24, 2016 at 2:57 AM, Henry M wrote: > I haven't tried the new SASI indexer but it may help: > https://github.com/apache/cassandra/

Re: DataModelling to query date range

2016-03-24 Thread Chris Martin
Hi Vidur, I had a go at your solution but the problem is that it doesn't match routes which are valid all throughtout the range queried. For example if I have route that is valid for all of Jan 2016. I will have a table that looks something like this: start | end| vali

Re: DataModelling to query date range

2016-03-23 Thread Henry M
I haven't tried the new SASI indexer but it may help: https://github.com/apache/cassandra/blob/trunk/doc/SASI.md On Wed, Mar 23, 2016 at 2:08 PM, Chris Martin wrote: > Hi all, > > I have a table that represents a train timetable and looks a bit like this: > > CREATE TABLE routes ( > start text,

Re: DataModelling to query date range

2016-03-23 Thread Vidur Malik
Flip the problem over. Instead of storing validTo and validFrom, simply store a valid field and partition by (start, end). This may sound wasteful, but disk is cheap: CREATE TABLE routes ( start text, end text, valid timestamp, PRIMARY KEY ((start, end), valid) ); Now, you can execute something l

DataModelling to query date range

2016-03-23 Thread Chris Martin
Hi all, I have a table that represents a train timetable and looks a bit like this: CREATE TABLE routes ( start text, end text, validFrom timestamp, validTo timestamp, PRIMARY KEY (start, end, validFrom, validTo) ); In this case validFrom is the date that the route becomes valid and validTo is t