Skip to content

Add FAQ about slow joins #320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"pymongo": ("https://pymongo.readthedocs.io/en/stable/", None),
"python": ("https://docs.python.org/3/", None),
"atlas": ("https://www.mongodb.com/docs/atlas/", None),
"manual": ("https://www.mongodb.com/docs/manual/", None),
}

root_doc = "contents"
Expand Down
13 changes: 13 additions & 0 deletions docs/source/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ FAQ

This page contains a list of some frequently asked questions.

Performance
===========

Querying across relational fields like :class:`~django.db.models.ForeignKey` and :class:`~django.db.models.ManyToManyField` is really slow. Is there a way to improve the speed of these joins?
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Not really. Joins use MongoDB's :doc:`$lookup
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: "Not really."

We could mention the possibility of using raw_aggregate() to manually construct a query as mentioned in #309, but I think that's unlikely to be an attractive and maintainable solution for most projects.

<manual:reference/operator/aggregation/lookup>` operator, which doesn't perform
well with large tables.

The best practice for modeling relational data in MongoDB is to instead use
:doc:`embedded models <topics/embedded-models>`.

Troubleshooting
===============

Expand Down