digital-garden/.trash/JOIN.md

21 lines
444 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
aliases:
tags:
- зрелость/🌱
date:
- - 2024-02-05
zero-link:
- "[[00 Базы Данных]]"
parents:
linked:
---
B MySQL используется метод nested loops, но с оптимизациями.
```sql
SELECT * FROM posts WHERE author = "Peter"
JOIN comments ON posts. id = comments.post_id
```
Индекс по `posts.id` бесполезен. Индекс по `comments.post_id` обязателен.