From: | "Silas Justiniano" <silasju(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Indexes |
Date: | 2006-01-17 19:53:37 |
Message-ID: | 1137527617.925425.200970@o13g2000cwo.googlegroups.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Another little doubt:
I've already asked that in #postgresql at freenode, but I didn't
understand well.
I have two tables:
Books
- book_id
- name
Authors
- author_id
- name
One book can have many authors and one author can have many books. To
make that possible, I need a third table:
Intermediate
- book_id
- author_id
My question is about the indexes in Intermediate table. Is the
following index:
CREATE UNIQUE INDEX foo ON Intermediate(book_id, author_id);
enough for every query I want to perform? Or should I need
CREATE UNIQUE INDEX foo ON Intermediate(book_id, author_id);
CREATE UNIQUE INDEX bar ON Intermediate(book_id);
CREATE UNIQUE INDEX baz ON Intermediate(author_id);
too?
Thank you very much. Bye!
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-01-17 19:56:41 | Re: mac os x compile failure |
Previous Message | Joshua D. Drake | 2006-01-17 19:51:54 | Re: mac os x compile failure |