Tags
- DB
- 뷰
- outer join
- 그리디
- 완전검색
- delete
- Vue
- 이진트리
- 큐
- distinct
- migrations
- SQL
- 백트래킹
- 통계학
- 스택
- Tree
- create
- Django
- regexp
- stack
- update
- 트리
- N:1
- Queue
- drf
- Article & User
- 쟝고
- M:N
- count
- ORM
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Notice
Recent Posts
Link
목록2024/05/11 (1)
데이터 분석 기술 블로그

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...
SW/DB
2024. 5. 11. 09:00