Answer the question
In order to leave comments, you need to log in
Is an index automatically created when creating a foreign key in PostgreSQL 10?
Hello.
Is an index automatically created when creating a foreign key in PostgreSQL 10?
Or does it need to be created manually?
Answer the question
In order to leave comments, you need to log in
No, it is not created. On the table to which the FK index refers, a unique one must already be created, on the table that refers to the presence of the index is not checked in any way and is not even required. It is only necessary to understand that FK - for each row triggers and without an index there will be N seqscan tables.
Usually the index is created manually. Sometimes intentionally not created.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question