From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Wells Oliver <wells(dot)oliver(at)gmail(dot)com> |
Cc: | pgsql-admin <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: n00b question re: indexes and constraints |
Date: | 2020-04-22 18:48:19 |
Message-ID: | CAKFQuwaf8TDx5D5e8Jjj0TLbSWL=GWMZFggPAe27X6AjW1u_2A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
For a single column unique definitely. For a multi-column separate indexes
to get subsets or different column order might be worthwhile.
David J.
On Wed, Apr 22, 2020 at 11:40 AM Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
wrote:
> Thanks, I should have been more specific, these are unique constraints I
> am concerned about: so yeah, creating an index on a set of columns where
> there's a unique constraint is redundant, correct?
>
> On Wed, Apr 22, 2020 at 11:31 AM David G. Johnston <
> david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
>> On Wed, Apr 22, 2020 at 11:26 AM Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
>> wrote:
>>
>>> Are constraints also indexes, or would you want an additional index on
>>> top of a constraint if you wanted that column/combo indexed?
>>>
>>
>> No, having a constraint does not imply that an index exists. However,
>> the enforcement of a "unique" constraint is implemented by auto-creating a
>> unique index.
>>
>> David J.
>>
>>
>
> --
> Wells Oliver
> wells(dot)oliver(at)gmail(dot)com <wellsoliver(at)gmail(dot)com>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Rui DeSousa | 2020-04-22 21:25:29 | Re: n00b question re: indexes and constraints |
Previous Message | Wells Oliver | 2020-04-22 18:39:33 | Re: n00b question re: indexes and constraints |