Speed between two different searches

Let’s assume I have a user type “personal trainer” and a user type “client”. Of course, multiple clients may belong to a trainer user.

In scenario 1:
The client user, has a member specifying the attached trainer account. So, if I wanted to list all of the trainers clients, I would do a search for every user that has that trainer user as a member

In Scenario 2:
I still record a clients trainer, BUT I also maintain a list of clients that I attach to each trainer. So now, to find the clients, I simply go straight to this list.

Would scenario 2 be considerably faster/ a good idea, especially as my user base becomes large?

edit: Currently I am only using the default user type, and I use boolean flags to designate roles in the system. So every user has the same fields technically.

Hi @alexsstockton :slight_smile: By user type do you mean a custom data type for “Personal Trainer” and a custom data type for “Client” (which each have a User field)?

If so, yes that setup would be faster to have a “Clients” field (type: Client, list: yes) within the Personal Trainer data type, and a “Personal Trainer” field (type: Personal Trainer, list: no) within the Client data type (assuming each Client can only have one Personal Trainer).

(Edit: Alternatively, if you anticipate you need to know when each Client started training with their Personal Trainer, the above setup would not be ideal. An additonal custom data type would need to be created (such as “Training”) in order to record the Client, their Trainer, the date they began training with that Trainer, and any other necessary fields)

Right now I have boolean flags on my users that designate what type of user they have. So technically every user has the same members.

Would it be better to create seperate, custom types, with the user field. As you mentioned?

That’s definitely one way to set it up, and I don’t mean to overcomplicate things if you’re trying to keep it simple, but it may not be ideal if your app gains complexity and you have certain fields which will only pertain to Trainers (i.e. Hourly Rate, Accepting New Clients?, Years of Experience, Certifications, Gym Location). Then when Clients need to find a Trainer, the Do a Search for will only go through the Trainers table, instead of all of the Users in the app.

Similarly, there may be certain fields which only pertain to Clients (i. e. Current Trainer, Health Risks, Injuries, Goals, Dietary Restrictions). Then if perhaps you had a feature which allows Trainers to search for Clients, the Do a Search for will only go through the Clients table, instead of the Users table. :slight_smile:

Makes sense, appreciate the feedback!

1 Like

No problem! :slight_smile: