It depends.
If you're not doing any queries using the foreign key, then you don't need any index. The referential integrity is enforced using the index of the referenced primary key.
The question of which index type to use (if any) is thus the same for any column(s). If your queries would benefit from an index for a =
comparison, and you're using PostgreSQL 10 or newer, then a HASH index is a reasonable choice. If the same column is involved in any ordering operations (ORDER BY
, <
, >=
, etc.) then you may as well use a BTREE.
If you are concerned about the relative performance, then you'll need to test them yourself, using your own data distribution and query load. A tree index may still perform better than a hash, due to data access locality (sequential vs. random).