Skip to content

Commit 27f8d17

Browse files
committed
Add FAQ about slow joins
1 parent b8efc93 commit 27f8d17

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"pymongo": ("https://pymongo.readthedocs.io/en/stable/", None),
4646
"python": ("https://docs.python.org/3/", None),
4747
"atlas": ("https://www.mongodb.com/docs/atlas/", None),
48+
"manual": ("https://www.mongodb.com/docs/manual/", None),
4849
}
4950

5051
root_doc = "contents"

docs/source/faq.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ FAQ
44

55
This page contains a list of some frequently asked questions.
66

7+
Performance
8+
===========
9+
10+
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?
11+
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
12+
13+
Not really. Joins use MongoDB's :doc:`$lookup
14+
<manual:reference/operator/aggregation/lookup>` operator, which doesn't perform
15+
well with large tables.
16+
17+
The best practice for modeling relational data in MongoDB is to instead use
18+
:doc:`embedded models <topics/embedded-models>`.
19+
720
Troubleshooting
821
===============
922

0 commit comments

Comments
 (0)