RE: Index Creation Questions
Posted in 1998
Carol,
Another thing is you can not create a foreign key relationship to the
table if it doesn't have a primary key constraint.
Also you should be aware that you get different error messages from a
constraint violation to a index violation.
P.S. sorry if you have already got this advice.
Regards
David Ashby
-----Original Message-----
From: Art S. Kagel [mailto:kagel@bloomberg.net]
Sent: Friday, 14 August 1998 3:36
To: informix-list@iiug.org
Subject: Re: Index Creation Questions
Schultheis, Carol L wrote:
>
> Can someone answer some basic general questions?
>
> 1. what is the difference between creating a unique
index on a column
> via the create unique index statement
> versus using the primary key constraint when
creating the table.
The primary key and index are essentially independent.
A primary key
constraint, or a unique constraint for that matter,
requires a unique
index to support it. If one exists on the same columns
the constraint
will use that index otherwise it creates one to use.
The index itself
is the same either way and the constraint behaves the
same. The main
gain from constraints over just adding the index is a)
the
documentation value and b) the integrity support from
the engine.
> 2. what is the difference between creating an index on
a column via the
> create index statement
> versus using the alter table and adding a foreignkey constraint.
Same as above except that the index does not have to be
unique.
Art S. Kagel