Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Learning Apache Cassandra
  • Toc
  • feedback
Learning Apache Cassandra

Learning Apache Cassandra

By : Brown
4.4 (13)
close
Learning Apache Cassandra

Learning Apache Cassandra

4.4 (13)
By: Brown

Overview of this book

If you're an application developer familiar with SQL databases such as MySQL or Postgres, and you want to explore distributed databases such as Cassandra, this is the perfect guide for you. Even if you've never worked with a distributed database before, Cassandra's intuitive programming interface coupled with the step-by-step examples in this book will have you building highly scalable persistence layers for your applications in no time.
Table of Contents (14 chapters)
close
13
Index

Retrieving status updates for a specific time range


Having explored the limits of the WHERE keyword in CQL, let's return to the user_status_updates table. Suppose we'd like to build an "archive" feature for MyStatus that displays all of the user's status updates for a requested month. In CQL terms, we want to select a range of clustering columns; for instance, let's get back all of alice's status updates created in May 2014:

SELECT "id", DATEOF("id"), "body"
FROM "user_status_updates"
WHERE "username" = 'alice'
AND "id" >= MINTIMEUUID('2014-05-01')
AND "id" <= MAXTIMEUUID('2014-05-31');

Before diving into the mechanics of this query, we can confirm that the only status update is the one with a UUID that was provided in the previous chapter, and was generated on May 29:

Creating time UUID ranges

In the preceding query, we encounter two new CQL functions: MINTIMEUUID and MAXTIMEUUID. These functions form perhaps the most powerful components of Cassandra's toolkit for working with timestamp...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete