Question about index/constraint definition in a table

Поиск
Список
Период
Сортировка
От JORGE MALDONADO
Тема Question about index/constraint definition in a table
Дата
Msg-id CAAY=A7_b6xhUN3CwUJw+5+5K60dcnV0buRHHRz2Vsmx_jcz6aw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Question about index/constraint definition in a table  (David Johnston <polobo@yahoo.com>)
Список pgsql-sql
I have a table as follows:
------------------------------------------------
Table Artist Colaborations
------------------------------------------------
* car_id (integer field, primary key)
* car_song (integer field, foreign key, foreign table is a catalog of songs)
* car_artist (integer field, foreign key, foreign table is a catalog of artists)

So, I added 2 indexes to improve JOIN in queries:
1. An index for car_song which accepts duplicates.
2. An index for car_artist which accepts duplicates.

Now, the combination of "car_song + car_artist" cannot be duplicated so I think that adding a constraint on these 2 fields is the solution.

My question: Is this the correct way to go?

Respectfully,
Jorge Maldonado

В списке pgsql-sql по дате отправления:

Предыдущее
От: skinner@britvault.co.uk (Craig R. Skinner)
Дата:
Сообщение: Many to many link tables with history?
Следующее
От: David Johnston
Дата:
Сообщение: Re: Question about index/constraint definition in a table