Subject Re: Indeks on primary key
Author Svein Erling
> > If I have a table where there is a primary key on field1 and
> > field2. Do I then gain anything from making an index on both
> > fields or a combined on both fields ?
> If you have a primary key constraint on those fields, an index is
> automatically created.

Assuming this index to be created as (field1, field2), you could in
some cases benefit from having a separate index for field2 since the
primary key index would only be useful for queries also specifying
field1 (it does matter in which order you specify the fields within
the PK).

Myself, I try to only use one field without any meaning for the PK, it
makes things simple.

Foreign keys also create indexes.