Re: will foreign key improve select query performance

Поиск
Список
Период
Сортировка
От Chris
Тема Re: will foreign key improve select query performance
Дата
Msg-id 47D0C3EF.9030501@gmail.com
обсуждение исходный текст
Ответ на will foreign key improve select query performance  ("petchimuthu lingam" <spmlingam@gmail.com>)
Список pgsql-php
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/

В списке pgsql-php по дате отправления:

Предыдущее
От: "petchimuthu lingam"
Дата:
Сообщение: will foreign key improve select query performance
Следующее
От: "petchimuthu lingam"
Дата:
Сообщение: join query performance