pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
will foreign key improve select query performance
2+ messages / 2 participants
[nested] [flat]

* will foreign key improve select query performance
@ 2008-03-07 04:18  petchimuthu lingam <spmlingam@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: petchimuthu lingam @ 2008-03-07 04:18 UTC (permalink / raw)
  To: pgsql-php

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


-- 
With Best Regards,
Petchimuthulingam S

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: will foreign key improve select query performance
@ 2008-03-07 04:26  Chris <dmagick@gmail.com>
  parent: petchimuthu lingam <spmlingam@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Chris @ 2008-03-07 04:26 UTC (permalink / raw)
  To: petchimuthu lingam <spmlingam@gmail.com>; +Cc: 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/



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2008-03-07 04:26 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-03-07 04:18 will foreign key improve select query performance petchimuthu lingam <spmlingam@gmail.com>
2008-03-07 04:26 ` Chris <dmagick@gmail.com>

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