简体   繁体   中英

DynamoDB - Data model for geohash and frequent updates

I'm build a location based "chat" application and am using Amazon's DynamoDB to take advantage of the high throughput and automatic scaling.

The application will frequently update user's location's in the database (I'm using a PHP geohash library). It will also search for users within a specific geographic radius.

I'm new to NoSQL (I have a lot of MySQL experience) and would like some input on modeling my "Users" table. Two concerns:

1) If the geohash / longitude / latitude attributes of users are updated frequently, will this cause an issue (table locking?) with DynamoDB? In MySQL, I would create a separate table for just those values to prevent locking the entire Users table. Do I need to worry about that in DynamoDB?

2) Searching for users in a geographic radius? Is this just setting up a Global Secondary Index on the geohash attribute and performing a query on that? Will sharding cause an issue with this?

For the first question I will suggest you to create new table, to keep your geohash / longitude / latitude because updating a column in a row in dynamoDB means updating the whole row . I think you know consequences of that .

Global Secondary Index is costly solution which amazon is providing , its almost cost the same amount a new table with same amount of data , so better to use geographic radius as primary index and in my project I am also doing same to group same type of records or u can create different table for each region which will give you more flexibility if amount of data is more .. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM