Foreign keys and slow insert - Mailing list pgsql-general

From Dan Black
Subject Foreign keys and slow insert
Date
Msg-id 27f6062505060808401a458177@mail.gmail.com
Whole thread Raw
Responses Re: Foreign keys and slow insert
Re: Foreign keys and slow insert
Re: Foreign keys and slow insert
List pgsql-general
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
{
  master_id INT4,
  master_name VARCHAR(64),
  CONSTRAINT master_pkey PRIMARY KEY (master_id)
}
create table slave
{
  slave_id INT4,
  slave_name VARCHAR(64),
  master_id INT4,
  CONSTRAINT slave_pkey PRIMARY KEY (slave_id),
  CONSTRAINT slave_fkey_master_id FOREIGN KEY (master_id) REFERENCES master (master_id) ON UPDATE CASCADE ON DELETE RESTRICT
}

Do I need to create index

CREATE INDEX my_index
  ON slave
  USING btree
  (master_id);

?

Thanks

--
Verba volent, scripta manent
My ISP  - http://www.netbynet.ru

pgsql-general by date:

Previous
From: Sebastian Böck
Date:
Subject: Bug with view definition?
Next
From: hubert depesz lubaczewski
Date:
Subject: deadlocks in multiple-triggers environment