Anyone using PostgreSQL, be advised that PostgreSQL will not automatically create an index for a foreign key. Primary keys and unique constraints will get an index automatically, but for foreign keys, you’ll need to create the index yourself.

This TIL was hard lesson to learn today.

PostgreSQL