Re: Indexes

From: Alban Hertroys <alban(at)magproductions(dot)nl>
To: Silas Justiniano <silasju(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Indexes
Date: 2006-01-30 11:16:18
Message-ID: 43DDF582.2010308@magproductions.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)magproductions(dot)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//

In response to

  • Indexes at 2006-01-29 18:03:34 from Silas Justiniano

Browse pgsql-general by date

  From Date Subject
Next Message Leif B. Kristensen 2006-01-30 11:49:45 Re: Indexes
Previous Message Alban Hertroys 2006-01-30 10:53:28 Re: Are rules transaction safe?