cash1981, basically you are right. A user can have multiple DVD and a DVD can have mulitple users. Modeling this relationship by many-to-many might be an option.
But how does this perform? I have about 40.000 DVDs, 30.000 users and 2.000.000 User-DVD-Relationships. A DVD can have 15.000 users or more. I don't think it is a good idea to have a collection of users (DVD owners) in the DVD object, is it?
My objective is to optimize as much as possible the following request:
A user searches for a DVD (e.g. by its title etc.) and in the list of matching DVDs, each DVD the logged in user already owns (= a User-DVD-relationship exists) is marked or not.
The question how to model this domain and how to query it is the key for a high performant system. Every idea is highly appreciated.
Thanks,
Chris
|