Bubble response below
I was able to speak to one of our engineers about this who let me know that we already store the related data type as its unique ID, so making it a text field wouldn’t improve performance.
We only retrieve the nested thing if there are any fields in the nested data type that are being used. So in this example, if there is a text box that says “User’s first name”, we would retrieve the User object only. If it says “User’s House’s address”, then we would retrieve both the User and House object.
It would be interesting to see a performance comparison here. I would imagine having the actual object be related would be faster than having to perform a second search using the text field as unique id constraint.
Thinking about situations when you have a repeating group of Users, in which you do not access any related fields, but when you select a User and send that value to another element (maybe a popup) you do access the fields, it would likely be faster to reference the related field directly than have to perform a search with constraint on the data inside of the popup. It is like when Bubble uses the slug in URL to populate current page content or when you use a Unique ID in a URL parameter and upon retrieval you indicate to Bubble the type of data it is; these usually seem to perform faster than an actual search with constraint of the unique id.