Skip to content

Commit efc7b56

Browse files
committed
Added two CREATE INDEX statements
1 parent 76feb37 commit efc7b56

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

1-intro-to-sql/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,13 @@ CREATE INDEX index_on_user_name ON users (user_name);
580580
CREATE INDEX index_on_project_name ON projects (project_name);
581581
```
582582

583+
It goes without saying that we need to index the foreign key columns:
584+
585+
```sql
586+
CREATE INDEX index_on_user_id ON contributorships (user_id);
587+
CREATE INDEX index_on_project_id ON contributorships (project_id);
588+
```
589+
583590
We also need to make sure that duplicate contributorships cannot exist.
584591

585592
We achieve this by creating a unique index on the combination of `user_id` and `project_id`:

0 commit comments

Comments
 (0)