Optimize DB schema
Andrei0872 opened this issue · comments
This is mainly for learning purposes.
When using foreign keys, Postgres doesn't automatically create indexes on them. Therefore, there could be some ways to optimize the DB overall.
Research:
- https://www.brianlikespostgres.com/cost-of-a-join.html
- https://www.cybertec-postgresql.com/en/index-your-foreign-key/#:~:text=Index%20at%20the%20target%20of%20a%20foreign%20key&text=Such%20constraints%20are%20implemented%20with,which
- https://stackoverflow.com/questions/970562/postgres-and-indexes-on-foreign-keys-and-primary-keys
- https://dba.stackexchange.com/questions/53809/need-for-indexes-on-foreign-keys