Search Postgresql Archives

Foreign keys and slow insert

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux