Skip to content

Commit 6c613c6

Browse files
committed
docs: Fixed "prefetch deeper relationships" documentation to make it clear it's not just a matter of not being "efficient" with heterogeneous targets - it literally doesn't work
1 parent 68682ce commit 6c613c6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/performance.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@ notifications = get_notifications(user).prefetch_related(
7373
)
7474
```
7575

76-
**Note**: This approach has limitations:
76+
**Warning**: This approach has serious limitations:
7777

7878
- You need to know the target's type and relationships in advance
79-
- It won't work efficiently with heterogeneous targets (different model types)
79+
- Only works when ALL notifications in the queryset have the same target model type
80+
- It will raise `AttributeError` with heterogeneous targets (different model types) - if even one notification has a different target type that lacks the specified relationship, the entire query will fail
8081
- Each additional relationship level requires explicit prefetching
8182

8283
#### For best performance

0 commit comments

Comments
 (0)