Question about foreign key - Mailing list pgsql-general

From Terence Leung
Subject Question about foreign key
Date
Msg-id 20021106114949.69045.qmail@web40706.mail.yahoo.com
Whole thread Raw
Responses Re: Question about foreign key  (Andrew Sullivan <andrew@libertyrms.info>)
List pgsql-general
Dear sir,
    Hi, I am Terence and using Postgresql 7.0 in linux
server and the web server can connect the database.
    I want to ask one question:
I have created two tables
1.
CREATE TABLE sys_user (
 id  serial primary key,
 login_name  varchar(32),
 password  varchar(32)
)

2.
CREATE TABLE sys_quest_list (
 id     serial primary key,
 owner_id    int4,
 quest_name  varchar(100)
)

I add a foreign to sys_quest_list

ALTER TABLE sys_quest_list ADD CONSTRAINT sqloifk
foreign key(owner_id) REFERENCES sys_user(id);

The sys_quest_list.owner_id is the foreign key to
sys_user.id

When I do the select SQL like this
 "select login_name,quest_name FROM sys_quest_list
JOIN sys_user ON owner_id=sys_user.id"

Can the added foreign key improve the above sql
performance so that it can search faster
   or the foreign key can only maintain the data
integrity but cannot make the search faster?

  Your help would be much appreciated.
  Looking forward to your reply.

   Thank you very much



=====
Yours sincerely,
    Leung Chun Man, Terence

    Mobile: (852) 9273 9176
    Homepage:  http://tcmleung.uhome.net ,
    http://www.dynamicdrive.com/dynamicindex4/filter/index.htm

__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

pgsql-general by date:

Previous
From: Jan Branbergen
Date:
Subject: Re: Problems with Now()?
Next
From: Lee Tuck
Date:
Subject: jdbc problem