Re: Django ManyToMany performance?
On Sunday, 27 October 2013 00:46:17 UTC+1, Ruturaj Dhekane wrote:
-- Hi all,I have a particular datastructure where there are two objects1. A document - and a lot of its properties - like content, version, timestamp etc.2. Contributors - basically people represented by unique IDsA document can have many contributors and a contributor can author many documents. A typical manyTomany scenarioIs there a design where I can find how ManyToMany is implemented (I know I can go through the code - but existing design document/wiki/blog might help).Also what are the performance implications?How many SQL queries does it really make per request on django?Can it scale to say 1million documents and a few thousand users?What is a good SQL backend I can use? MYSQL or SQLite?Has anyone tried with MondoDB etc for such relationships?Any examples where you have used ManyToMany and scaled it up for many entries?Thank you for your answers. Would give me a lot of confidence in going ahead with choosing M2M as a field. The whole project might hinge on it!Ruturaj
This question is a bit too vague to answer. A many-to-many relationship in a Django database is implemented just as it would be in any other SQL db - with an intermediate linking table containing foreign keys to both sides of the relationship - and queried via JOINs between the three tables. The only difference is that the linking table isn't exposed unless you specifically ask it to be.
There's nothing specifically efficient or inefficient about the m2m field: it just is what it is. If it fits your data model - which, given your description, I'd say it does - you should use it.
--
DR.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bfaef3b6-6fb6-473a-80d2-b1730884ebfd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home