0% completed
Could you elaborate a bit on the following:"If we go with a NoSQL database, we n...
JC Denton
Jan 10, 2022
Could you elaborate a bit on the following:
"If we go with a NoSQL database, we need an additional table to store the relationships between users and photos to know who owns which photo. Let’s call this table ‘UserPhoto’"
The Photo collection has a reference to userId, so I am guessing you could filter on that field without a UserPhoto table. Is the UserPhoto table an optimization?
6
0
Comments
DogBiscuit 4 years ago
The diagram is a little mixed up. The db schema diagram would be for a rdbms. With a nosql key value store, there's no user id field. Just key for photoid, and object as photo data
Aruna Kalagnanam4 years ago
Even for a NoSQL database, say, DynamoDB, it is possible to have a photoId as the primary key and still be able to filter on the userId attribute.
Prabhakar 4 years ago
To filter on userID, we may need something like DynamoDB 'Global Secondary Index' to be able to query on it. Is that right?
Aruna Kalagnanam4 years ago
Yes, with a Global Secondary Index, DynamoDB will allow a query by userId (partition key for the GSI) and will retrieve a list of photos for that userid.
On this page
- What is Instagram?
Try it yourself
Designing Instagram (video)
- Requirements and Goals of the System
- Some Design Considerations
- Capacity Estimation and Constraints
- High Level System Design
- Database Schema
- Data Size Estimation
- Component Design
- Reliability and Redundancy
- Data Sharding
- Ranking and News Feed Generation
- News Feed Creation with Sharded Data
- Cache and Load balancing