7 Reading Data from ScyllaDB

 

This chapter covers

  • Reading data from ScyllaDB
  • Limiting, grouping, sorting, and paginating queries
  • Understanding read performance
  • Using ScyllaDB to denormalize your data via materialized views and indexes

When you store data in a database, you’re saving it there to read later. In the last chapter, you learned about saving data — and deleting it — from ScyllaDB. Accordingly, in this chapter, it’s time to learn about reads. You’ve done some basic SELECT queries already, but here, you’ll learn more about the various clauses you can add to those queries to get exactly the data you’re looking for. You’ll also look into read performance so that you can understand your queries' behavior and avoid burdening your cluster with a deluge of slow queries. Lastly, you’ll learn about how ScyllaDB can aid you in denormalizing your data models, offering tradeoffs between query speed and data storage to reduce your maintenance efforts.

In preparation for this chapter, I’ve included a dataset containing some sample rows in the book’s code repo at https://github.com/scylladb-in-action/code.

In the ch07 folder is a file — 1-dataset.cql. Copying its contents into your cqlsh session inside one of the Scylla Docker containers will insert several rows to each of the tables, giving you rows to query against that you don’t have to type up and insert yourself. Once you’ve got that set up, it’s time to begin reading about reading.

7.1 Selecting

 
 

7.1.1 The basics

 
 
 

7.1.2 Limiting results

 
 

7.1.3 Paginating queries

 
 

7.1.4 Ordering results

 
 
 

7.1.5 Counting

 
 
 
 

7.1.6 Grouping rows in your queries

 

7.2 Read performance

 
 

7.2.1 What does a read do?

 

7.2.2 Avoiding slow queries

 
 
 

7.2.3 Allowing filtering

 

7.3 Materialized views

 
 

7.3.1 Constructing a view

 

7.3.2 Easier denormalization

 
 

7.3.3 Indexes

 
 

7.4 Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest