- stack
- 이진트리
- update
- SQL
- Article & User
- migrations
- 완전검색
- DB
- count
- 그리디
- Vue
- distinct
- ORM
- Queue
- Django
- N:1
- M:N
- 뷰
- create
- drf
- outer join
- 트리
- 큐
- regexp
- 스택
- Tree
- 백트래킹
- 쟝고
- delete
- 통계학
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
목록select_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..
select_relatedSQL의 INNER JOIN 쿼리를 활용합니다. 1:1 또는 N:1 참조 관계에서 사용합니다.문제 상황select_related 적용문제를 해결해 봅니다.게시글을 조회하면서 유저 정보까지 한 번에 조회해서 가져옵니다.# views.pydef index_2(request): # articles = Article.objects.order_by('-pk') articles = Article.objects.select_related('user').order_by('-pk') context = { 'articles': articles, } return render(request, 'articles/index_2.html', context)"11 qu..