开发者

BigTable query with IN operator to get all user group keys

开发者 https://www.devze.com 2023-02-06 08:05 出处:网络
I have little problem with permissions in my future social application. Platform will nonrel db (Google\'s BigTable).

I have little problem with permissions in my future social application.

Platform will nonrel db (Google's BigTable).

In my application each user has groups (for example: friends, collaborators, family...). In group has some friends (like in Facebook). And can publish some content (news, short text, ...) only for this group. If I have user in my group it is my friend. Like in Facebook, but more groups.

My idea is, that each user can see (on himself "feed") all last content of all friends in one page (like as Facebook's Top news). But I have problems wit开发者_如何转开发h creating simple query.

For example:

SELECT * FROM News WHERE group_key IN [list_of_groups_where_i_am]

This works good, but there are sub-queries and limit of list is 30 items. Other way is strong caching of content.

Does anybody have some idea? Or any study material, example...


With a requirement like this you can optimize for either read or write, but usually not both. You have the write optimized version - just write a record with the right group key but have a complex query to get content for all the groups.

The read optimized version would be to write the content (or just its id) to a feed for each user, which makes the read query very simple.

0

精彩评论

暂无评论...
验证码 换一张
取 消