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

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.

主站蜘蛛池模板: 泌阳县| 台中县| 基隆市| 仁化县| 渝北区| 中阳县| 赞皇县| 商丘市| 图们市| 库伦旗| 佛教| 且末县| 礼泉县| 中山市| 万荣县| 江川县| 五河县| 西城区| 黔江区| 六枝特区| 江陵县| 兴海县| 双城市| 江都市| 昭通市| 永和县| 随州市| 香港| 丰宁| 邢台市| 满城县| 湛江市| 女性| 石景山区| 博兴县| 名山县| 辽源市| 应城市| 冀州市| 尼勒克县| 泰来县|