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

Paginating over rows in a partition

As our users create more and more status updates, we'll build pagination functionality into MyStatus so that the information on the page doesn't overwhelm readers. For the sake of convenience, let's say that each page will only contain three status updates.

To retrieve the first page, we'll use the LIMIT keyword that we first encountered in Chapter 2, The First Table:

SELECT "id", DATEOF("id"), "body"
FROM "user_status_updates"
WHERE "username" = 'alice'
LIMIT 3;

As expected, Cassandra will give us the first three rows in ascending order of id:

Paginating over rows in a partition

Now, we'll ask for the collection of rows where the id value is strictly greater than the last id we saw:

SELECT "id", DATEOF("id"), "body"
FROM "user_status_updates"
WHERE "username" = 'alice'
  AND id > 3f9df710-e8f7-11e3-9211-5f98e903bf02
LIMIT 3;

This is similar to the...

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