Question of computing speed and efficiency

Newbie here. Say I have a 100,000 pictures of 2000 houses.

If I want to pull up photos of a single house is it better to:

  1. Give each photo a “house” field and do a search with a constraint of all photos that match that field.

  2. Give each house a photos field (list) and list all the photos of that house.

In the real world #2 would be faster, but I don’t understand exactly how things work behind the scenes.

2 should be faster for looking up all photos of that house.

Do note - when you include a list of things as a field on a parent thing (e.g., a list of photos on the house) then anywhere you load data about that house, Bubble automatically grabs the data for the listings of the photos as well. So, if you have a page that doesn’t display the photos then having your database structured this way would make that page a bit slower even though the photo’s aren’t displayed (because Bubble loads all of the rows in a table when it loads the thing).

So, there’s a set of trade-offs to this. I’d guess it’s probably better to include the list of photos on the house.