Re: Unique index VS unique constraint

Поиск
Список
Период
Сортировка
От Sergey Konoplev
Тема Re: Unique index VS unique constraint
Дата
Msg-id CAL_0b1uAZLLLipu0_RhcqrsAE1WkBJVYHHOfHuP1VcZVMzKAtg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Unique index VS unique constraint  (JORGE MALDONADO <jorgemal1960@gmail.com>)
Список pgsql-sql
On Sat, Oct 5, 2013 at 3:24 PM, JORGE MALDONADO <jorgemal1960@gmail.com> wrote:
> So, let´s say that I have the following simple example table:
>
> 1. cus_id
> 2. cus_name
> 3. Other fields . . .
>
> Where "cus_id" is the primary key. And let´s also say that I want "cus_name"
> to be unique. I have the option to create a unique constraint or a unique
> index. What would be the best decision and why?

Unique constraint would be the right choice, because you want to
constrain the values in the column of your table. The unique index is
just a tool the constrain uses to perform its function. This index
will be created automatically when you add the constraint.

--
Kind regards,
Sergey Konoplev
PostgreSQL Consultant and DBA

http://www.linkedin.com/in/grayhemp
+1 (415) 867-9984, +7 (901) 903-0499, +7 (988) 888-1979
gray.ru@gmail.com



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

Предыдущее
От: JORGE MALDONADO
Дата:
Сообщение: Re: Unique index VS unique constraint
Следующее
От: Kaleeswaran Velu
Дата:
Сообщение: ...