Accessing list of things from a field of a thing or searching for items through a foreign key?

I’m making a basic messenger. So I have Chat and Message things and I see 2 ways of organizing data:

  1. Add a field Messages in the Chat thing to contain a list of Message things so that I can just display the list of messages from that field
  2. Add a field Chat in the Message thing to act as a foreign key so that I perform a Search for query to display the messages in a chat

Which would work better in Bubble? Maybe there’s some other better way? Of course making a search seems like a more complicated way, but will a list of things work ok as field of a thing when it’s thousands of items long and I probably won’t load them all at once so I’ll need a search\filter anyway?

Thanks!

In most cases Option 2 is the way to go here… (but, like all things, it does depend on the specifics of your app)…

But I’d definitely recommend option 2 for this.

Thanks for your reply! Do you know if there’s a detailed description of how bubble database queries work?
Because I couldn’t find any and have lots of smaller questions on how to optimize perfomance. For example is there any profit if while performing a search I put a constraint on date first and then on id (so that I only search for messages with a certain chat_id created after chat_creation_date).