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

Looking up rows by partition

The core reading experience of the MyStatus application will be an interface to read a given user's status updates. In order to do this, we need to be able to retrieve status updates for a given user from the user_status_updates table. As you might expect, this follows naturally from the CQL syntax we've seen in previous chapters:

SELECT * FROM "user_status_updates"
WHERE "username" = 'alice';

Previously, we've used the WHERE keyword to specify an exact value for a full primary key. In the preceding query, we only specify the partition key part of the primary key, which allows us to retrieve only those rows that we've asked for the partition:

In the results, we only see the rows whose username is alice. To emphasize what we discussed in the previous chapter, in the Looking up a specific status update section, this is a very efficient query. Cassandra stores all of alice's status updates together, already in order; so returning this view of the table is quite inexpensive.

主站蜘蛛池模板: 巫溪县| 南陵县| 苏尼特左旗| 正安县| 沙河市| 神农架林区| 彩票| 阜平县| 奉新县| 和平县| 阿坝县| 凤山市| 古田县| 岳西县| 周宁县| 集贤县| 全椒县| 高台县| 哈巴河县| 遵化市| 桑日县| 濮阳市| 额尔古纳市| 永吉县| 佛坪县| 会理县| 虞城县| 辽阳市| 康乐县| 淅川县| 丰原市| 延津县| 蒲江县| 鄂尔多斯市| 黔西县| 金山区| 綦江县| 隆尧县| 南城县| 万山特区| 衡水市|