From: Chris <dmagick@gmail.com>
To: petchimuthu lingam <spmlingam@gmail.com>
Cc: pgsql-php@postgresql.org
Subject: Re: will foreign key improve select query performance
Date: Fri, 07 Mar 2008 15:26:23 +1100
Message-ID: <47D0C3EF.9030501@gmail.com> (raw)
In-Reply-To: <cd233fc30803062018o161cb94fua346801b4ac10dc2@mail.gmail.com>
References: <cd233fc30803062018o161cb94fua346801b4ac10dc2@mail.gmail.com>
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/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: dmagick@gmail.com, spmlingam@gmail.com
Subject: Re: will foreign key improve select query performance
In-Reply-To: <47D0C3EF.9030501@gmail.com>
References: <cd233fc30803062018o161cb94fua346801b4ac10dc2@mail.gmail.com> <47D0C3EF.9030501@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox