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@xxxxxxxxxxxxxxxxx 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//