Building a Real Estate Website as a Service, so the database will contain multiple companies each having their own properties that they sell. They will be sharing the same database. I was wondering what type of key i should choose. Since i might have to do some joins based on the companyId and do a lot of searched based on companyId. The database somehow is split based on the companyId in each table.
Properties:
- id
- companyId
- price etc…
PropertyType:
- id
- companyId
- name
So in one case I might have to get all Properties of a specific company.
Another case i might have to join a Property with PropertyType but I want to make sure that these joins are not stored in different servers or something.
I read a little about shard keys but not sure, if that’s the right way or should i use Index Key on companyId but not sure if that might cause problem down the line where PropertyType might be stored in a different datacenter or something and might be slow etc…
Any help or direction is really appreciated