Performance difference between lists and instances?

Hi - maybe dumb question:

Lets take a simple case like a forum thread/post:

  1. Is it better to have one composite which has an underlying data model which is a list (to accommodate multiple posts on a thread), or use a more simple data model and have many instances (one for each post in the thread)?
  2. Maybe within ComposeDB this doesn’t matter?

Thanks,
Kevin

Hey, Kevin.

Thanks for reaching out :slight_smile: !

(…) one composite which has an underlying data model which is a list (to accommodate multiple posts on a thread)

Do you mean something like:

type Thread @createModel(...) {
  posts: [String]! @list(...)
  ...
}

?

If so, I think it would definitely be better to have a separate model for posts. I think it will scale better and will be easier to query.

thanks, we are a chat program, so we could have 1000’s of messages between two parties, which I guess is slightly different than my example I gave :slight_smile:

I didn’t know if when querying to load the data it would be faster for any reason to have this in one model vs many.

I’ll go with a single model for each message. Thanks!

1 Like

Awesome! Please, let us know, if you want to discuss anything else :slight_smile: .