Database Reference
In-Depth Information
Selecting more than one row
Let's say we'd like to build an administrative interface that allows employees to access data
for several users in one screen. We could, of course, simply perform a query for each user-
name specified, but Cassandra gives us a more efficient way to do this:
SELECT * FROM "users"
WHERE "username" IN ('alice', 'bob');
This query will return two rows: one with the
alice
primary key and the other with the
bob
primary key:
Note that while this will be faster than performing two queries, it does require Cassandra to
perform two seeks for the two rows, so querying for the additional row comes at some cost.