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

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.

主站蜘蛛池模板: 苏尼特右旗| 大洼县| 宝鸡市| 浮山县| 梨树县| 陈巴尔虎旗| 唐河县| 恩平市| 双流县| 肇庆市| 临江市| 万山特区| 都江堰市| 南雄市| 公主岭市| 牙克石市| 兰西县| 黄大仙区| 南岸区| 航空| 西平县| 酒泉市| 孝义市| 封丘县| 醴陵市| 夏河县| 福州市| 大新县| 高雄市| 长春市| 宁城县| 前郭尔| 营口市| 长治市| 景宁| 曲阳县| 文水县| 潜山县| 商城县| 莱西市| 涪陵区|