PostgreSQL does not automatically create Indexes for Foreign keys.
This was found out while solving T452. Without indexes, queries like:
SELECT * FROM result WHERE 115515 = result.job_id;
take about 250 ms. With index on the Foreign key, it is 0.048 ms.