Subject | Re: Indeks on primary key |
---|---|
Author | Svein Erling |
Post date | 2003-10-10T08:58:07Z |
> > If I have a table where there is a primary key on field1 andAssuming this index to be created as (field1, field2), you could in
> > 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.
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.