liveBook · Manning

Access pattern

As explained in ScyllaDB in Action

A query pattern is a recurring form of data retrieval or mutation that an application must support.

An access pattern is a recurring form of data retrieval or mutation that an application must support. In ScyllaDB, it guides data modeling: design tables around the queries the application needs to perform. section 1.2.7 section 2.3.2

For the restaurant-review application, useful access patterns include:

  • Read all reviews for one restaurant by querying the partition key. section 2.3.2
  • Read a review by restaurant and ordering time, supplying both restrictions so the query can reach the relevant partition. section 2.3.2
  • Avoid queries that filter only by a non-partition-key column, because ScyllaDB may scan every partition. section 2.3.2

Restaurant reviews

SELECT * FROM initial.food_reviews WHERE restaurant = 'Ernie''s Eats'; reads reviews within one partition. Adding ordered_at narrows the lookup further, while filtering only by ordered_at can trigger a warning and an expensive scan. section 2.3.2

cqlsh> SELECT * FROM initial.food_reviews WHERE restaurant = 'Ernie''s Eats';

Browse a partition-key query that retrieves the reviews for one restaurant. section 2.3.2

How ScyllaDB in Action covers it

How deep it goes
Explains partition-key routing, cross-partition scans, and performance consequences through concrete CQL queries.
Examples
Uses restaurant-review lookups by restaurant, ordered_at, or both, including CQL output and a filtering warning.
What you can do after
Apply it via CQL by structuring data and queries around partition-key access instead of broad partition scans.
How it connects
Connects data modeling with partition keys, filtering, query routing, performance, and transactional database choice.

Also explained in

Compare how 3 books explain access pattern →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ScyllaDB in Action. The section links point to the parts of the book it draws on.