'how to improve many to many relationship in django
I have 2 models User and Content and they have relationship called Watched which is many-to-many.
this relationship will be using a third table (using through in Django) and how it works is that for each set of user and content we are going to keep what was the last position before they stopped watching and there is going to be one row per each user-content so if a user watches a content multiple time first time that row is created and next times that row only updates to keep the last data.
our database engine is mariadb.
currently we have about 10000 users and 4000 contents. so at max that third table would have 40,000,000 and we expect to have about 15000 users and 6000 content so it need to be able to handle 90,000,000 record at most.
Question 1:
someone suggested we handle the third table ourselves and don't use the many-to-many relationship offered by Django because it might use some joins and queries that will be heavy for database.
(so it would be a table with 2 integer fields for id and 1 other field for last position)
is this a good solution or we should stick to the relationship created by Django?
Question 2:
How can we improve it for larger users and contents?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
