- outer join
- count
- distinct
- 백트래킹
- 완전검색
- 스택
- DB
- Vue
- M:N
- Queue
- regexp
- Django
- N:1
- SQL
- 이진트리
- Tree
- create
- migrations
- 쟝고
- stack
- drf
- ORM
- 뷰
- 그리디
- 큐
- 통계학
- delete
- 트리
- Article & User
- update
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
목록prefetch_related (2)
데이터 분석 기술 블로그
문제 상황prefetch_related 적용문제 해결 1단계입니다.게시글을 조회하면서 참조된 댓글까지 한 번에 조회합니다.# views.pydef index_4(request): # articles = Article.objects.order_by('-pk') articles = Article.objects.prefetch_related('comment_set').order_by('-pk') # articles = Article.objects.prefetch_related( # Prefetch('comment_set', queryset=Comment.objects.select_related('user')) # ).order_by('-pk') "111 queries includin..
prefetch_relatedM:N 또는 N:1 역참조 관계에서 사용합니다. SQL이 아닌 Python을 사용한 JOIN을 진행합니다.문제 상황prefetch_related 적용문제를 해결해 봅니다.게시글을 조회하면서 참조된 댓글까지 한 번에 조회해서 가져옵니다.# views.pydef index_3(request): # articles = Article.objects.order_by('-pk') articles = Article.objects.prefetch_related('comment_set').order_by('-pk') context = { 'articles': articles, } return render(request, 'articles/index_3...