| From: | "Culley Harrelson" <culleyharrelson(at)yahoo(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Multi-key indexes |
| Date: | 2001-04-08 16:42:07 |
| Message-ID: | 9aq40k$2v8g$1@news.tht.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi, I wanted to verify the behavior of multi-key indexes. I have this
table:
create table fe_group_member(
group_id int4 not null references fe_group(group_id) on delete cascade,
user_id int4 not null references fe_user(user_id) on delete cascade,
ins_date timestamp not null default 'now',
primary key(group_id, user_id)
);
Now if I do:
select * from fe_group_member where group_id = 1;
I think the index created by the primary key will be used. Is this correct?
And if I do:
select * from fe_group_member where user_id= 1;
then the primary key index will not be used and I need to create an index on
user_id for better performance. Do I have this right?
Culley
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2001-04-08 16:47:29 | Re: Info for Solaris-FAQ and prob Unixware-FAQ |
| Previous Message | anil | 2001-04-08 16:41:52 | Re: Better Features document? |