Re: Indexes - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Indexes
Date
Msg-id 43DDF582.2010308@magproductions.nl
Whole thread Raw
In response to Indexes  ("Silas Justiniano" <silasju@gmail.com>)
List pgsql-general
Silas Justiniano wrote:
> 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);

If you'd use plain indexes for the last two (without the UNIQUE part),
queries that would need to lookup only 1 of the columns in this table
could be faster (depending on which version of postgres you run - I
don't think it'll make any difference in 8 and up).
The same thing goes for all tables that have a foreign key to another
table; an index on those columns may help.

Mind you, this is more about optimization, not so much about database
design. It depends on your queries whether you're going to have any
benefit from this.

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
    7500 AK Enschede

//Showing your Vision to the World//

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: Are rules transaction safe?
Next
From: "Leif B. Kristensen"
Date:
Subject: Re: Indexes