Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: will foreign key improve select query performance



petchimuthu lingam wrote:
If i create foreign key references, whether it will improve the performance in the select query?

Foreign keys are used to create integrity in the database, it won't affect select performance.

eg:

create table users (
  userid int primary key,
  username text
);

create table news (
  newsid int primary key,
  created_by int references users(userid)
);

That means that a news item cannot be created by a userid that doesn't exist.

http://www.postgresql.org/docs/current/interactive/tutorial-fk.html

--
Postgresql & php tutorials
http://www.designmagick.com/



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group