I’m trying to design a scaleable approach to modeling a social photo gallery and user profiles.

Every profile will have 1 gallery.

My current idea is the following:

  1. Photo table (id, photourl, fKey userId, fKey emailId)
  2. Profile table (id, username, fKey userId, fKey emailId)
  3. User table (id, fKey emailId[])
  4. Email table (id, publicKeyAddreess)
  5. Edge table (id, fKey1, fKey2, entity1Type, entity2Type, relationship: ENUM, weight: string, hide: bool)

Basically every user can have multiple emails. Each email can have multiple profiles. Each profile should be able to display its owner’s photos in a reorderable gallery.

I’m currently thinking of using the edge table to create edges (like a graphDB) to represent ownership between photos and a Profile. Profiles can feature photos they uploaded or photos other users uploaded.

The feature in the profile would comprise of an edge relationship between the photo table and the profile table. Obviously if hide = true, the photo is hidden from public view but still shows up in edit mode for profile owner. The weight is basically a string that is sorted alphabetically so maybe 3 photos are weighted in order: 1: a, 2: b, 3: c; if we want the third photo to reorder to order 2, the new weights could be: 1: a, 3: aa, 2: b

Any ideas on this? I built a prototype but it’s a bit slow. I’d like it to scale to be able to handle tens of thousands of photos / profile.

It’s particularity slow on the initial import process of a user has multiple profiles (let’s assume 100 profiles for argument, and maybe 100,000 photos).

In this setup, I’m creating 100,000 x 10 edges for each profile since each profile could have a different custom order. I also need to be able to handle updates to this setup if the profile owner decides to upload new photos and delete existing batches. Obviously these numbers are quite large but the idea is that I’m seeing degraded performance for thousands of photos right now so any pointers highly appreciated.

  • Welcome to the DBA.SE community. Seems like you already have something designed and are looking for ways to improve it. How should the community be able to improve something that it cannot see? If you could share more details, then the community might be able to help. Hit edit and add more details of what you already have designed (factual, not hypothetical). Thanks.
    – John K. N.
    Mar 1 at 6:49


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.