Single thing vs list of things:first item

Has anyone ever tested performance differences between linking to a single thing vs linking to a list of things and retrieving only the first item?

Let’s say you have a Company thing that will likely only ever have a single admin User. Easy to simply add a single admin User field to the Company thing. However, it’s much more scalable to make that field a list of things (and only put one thing in the list) in the chance you may want more than one Admin user in the future.

So, ignoring the method of doing a search for users of that company that are also admins etc, is there a real performance difference between these two statements:

  • This Company’s Admin

  • This Company’s list of Admins:first item

I suppose I could have tested it myself before posting :smiley: It appears it does make a rather significant difference.

1 Like

Are you sure it is not because of the order it is performed in? Did you try to search first for the list/first item?

You could model your company as a thing with a n:1 relation to the Admin. Whenever the company is loaded you’ve got the admin without search.

I swapped them around in the off chance that made a difference and it returned the same results.

However, I switched the referenced users and it changed the result dramatically. Which is really odd as the users are exactly the same aside from being different records. Literally an empty user with an email address and a name (text field)

Going down the rabbit hole now anyways, I added a ‘Search for user where admin is yes and company is this company’ and made the result of each reference (admin, list of admins:first item, and search for admin) the same user.

Here’s what I got:

Still some difference but much less dramatic.