Dan Black wrote:
I read in documentation that primary key doesn't require additional indexes but I could find nothing about foreign keys.
Do I need to create additional indexes when I create foreign keys?
Example:
create table master

create table slave

Do I need to create index
CREATE INDEX my_index
ON slave
USING btree
(master_id);

Yes. The primary key uses a "UNIQUE INDEX" to enforce uniqueness, so you get the index for "free". The foreign-key has no such constraint of course.

--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

              http://archives.postgresql.org

Reply via email to