官术网_书友最值得收藏!

Retrieving all the rows

Perhaps we'd like to expand our administrative interface to show a list of all the users who've signed up for MyStatus. To do this, we'll want to simply ask Cassandra for all the user records:

    SELECT * FROM "users";

Since we omitted the WHERE portion of the query, Cassandra will simply return all rows in the users table:

If you've been following along with the examples, you'll see that the latest query returns both rows that we've inserted into the database. However, had we inserted over 10,000 rows, we'd notice that only 10,000 rows would be returned. This is a limit built into cqlsh; using a language driver, you can retrieve result sets of arbitrary size.

You'll also notice that bob is returned before alice. Clearly, rows are not returned in lexical order of their primary key. As it happens, in a table with a single primary key column, row ordering is deterministic but not defined from a client standpoint. Deterministic ordering is enough, however, to allow us to  page through very large result sets.

You'll find a full reference for the SELECT statement in the DataStax CQL documentation at http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/select_r.html.

主站蜘蛛池模板: 海丰县| 利津县| 万年县| 措勤县| 铜梁县| 资阳市| 于田县| 定边县| 长泰县| 正蓝旗| 辛集市| 广河县| 绍兴县| 宝清县| 日喀则市| 宿州市| 张掖市| 金坛市| 托克逊县| 开原市| 黔西县| 靖宇县| 黄石市| 崇信县| 榆社县| 宣城市| 吉木萨尔县| 泾源县| 德惠市| 菏泽市| 冕宁县| 临漳县| 贵德县| 拉萨市| 南召县| 荥阳市| 丰顺县| 无锡市| 苍南县| 玉田县| 丰宁|