I have one publication with 10 fields for my first template.
I have another template where I need only 5 fields of the same publication. Since user can access both, depending on the loaded template, security is out of concern.
The question:
Performance-wise, should I make another publication with only the 5 fields I need, or should I rely on my first publication?
I expect it to be a trade-off between:
cursor.observe()
)Another solution could be to create 2 publication: the basic with 5 field and another one with the 5 other fields. In my first template, I subscribe to both, in the second I subscribe to the first only.
I understand the theory, but I can't infer from it what is the best approach. I expect there are good practices in these kind of cases.
All could be equivalent too, and it would make it an unnecessary micro-optimization (and that would answer my question).
Thanks!
I think you definitely have the right thought process and it's hard to say if I should optimize now or later. I would suggest doing it if it's not taking very much time.
For the case where you have a lot of users, you definitely want your app to track the minimal amount of database fields possible. I think your approach with two subscriptions is good. One thing I would suggest is reducing the amount of subscriptions for the first template by having a publication that has all 10 fields, so it doesn't have to subscribe twice.
Hope that helps!