Indexes - Mailing list pgsql-general

From Silas Justiniano
Subject Indexes
Date
Msg-id 1138557814.398351.225950@g49g2000cwa.googlegroups.com
Whole thread Raw
Responses Re: Indexes  (Michael Glaesemann <grzm@myrealbox.com>)
Re: Indexes  (Alban Hertroys <alban@magproductions.nl>)
Re: Indexes  ("Leif B. Kristensen" <leif@solumslekt.org>)
Re: Indexes  (Greg Stark <gsstark@mit.edu>)
List pgsql-general
Silas Justiniano
    Jan 17, 5:53 pm   show options
Newsgroups: pgsql.general
From: "Silas Justiniano" <sila...@gmail.com> - Find messages by this
author
Date: 17 Jan 2006 11:53:37 -0800
Local: Tues, Jan 17 2006 5:53 pm
Subject: Indexes
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse

hi.

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!


pgsql-general by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Basic questions about PQprepare()
Next
From: Christopher Browne
Date:
Subject: Re: Indexes