Question about foreign key

Поиск
Список
Период
Сортировка
От Terence Leung
Тема Question about foreign key
Дата
Msg-id 20021106114949.69045.qmail@web40706.mail.yahoo.com
обсуждение исходный текст
Ответы Re: Question about foreign key  (Andrew Sullivan <andrew@libertyrms.info>)
Список 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 по дате отправления:

Предыдущее
От: Jan Branbergen
Дата:
Сообщение: Re: Problems with Now()?
Следующее
От: Lee Tuck
Дата:
Сообщение: jdbc problem