Ideal database structure for managing images similar to AirBnB

Hi everyone,

I’m hoping someone can help me settle on the right DB structure for my situation that optimises for speed and performance at scale.
I’m running a marketplace that allows both parties to upload photos, manage those photos, enrich them with information such as a description, as well as being able to reorder them.

Taking one side - Locations - as an example, the following user needs are:

  • Photos are displayed on the location page
  • A location owner can change add new photos
  • A location owner can delete photos
  • A location owner can add a description to a photo
  • A location owner can reorder their photos with drag and drop

Essentially, I’m recreating a location page exactly like AirBnB (just not a travel marketplace) and the location owners would need to manage the photos for that location.

So far I see 2 options.

Option 1:

Location with a list of Location Photos

This feels easier but I’m worried that on pages that load all locations, it means it will load all the images of all the locations as well, which feels risky. Or is the degree of separation by having the image itself on the Location Photo data type enough?
The dual way ownership will also be annoying to manage during creation.

Option 2

Location with a single Location Photos with a table of Location Photo

This feels like it would perform better but is more layers to manage.

Appreciate any tips you can provide, thanks!

The first option will already do the job of optimizing the searches.

It will download the images only when you really need to open the DB Location photo

Thank you for the response!
So if I have a page listing all locations, the client won’t download all the photos listed in each location?
That’s my main concern with that option so that’s good to know!

The good practice for those searche page is to have a separate Data type only for search.

Eg: Airbnb
Data Type 1: Properties_searche - where you have data like title, city and price for example, and maybe only 1 photo for display.

Data type 2: All the other heavy data filds. This one will be only used when you enter the property page for example. Here you can have listed all the images and unstructured data.