FKs and indexes
Posted in 1999
Topics: General Discussion
Here's another question for the group: What are the differences between
these two things:
-- First thing
CREATE TABLE foo (
col1 INTEGER,
col2 INTEGER
);
ALTER TABLE foo ADD CONSTRAINT PRIMARY KEY (col1) CONSTRAINT foo_pk;
-- Second thing
CREATE TABLE foo (
{as above}
);
CREATE UNIQUE INDEX foo_ix00 ON foo(col1);
ALTER TABLE foo ADD CONSTRAINT PRIMARY KEY (col1) CONSTRAINT foo_pk;
In the second way, you get to choose the name for the index, and in the
first way, you don't. But is there anything more subtle than that? That
is, does an implicitly created index behave any differently than an
explicitly created one?
TIA,
- Tom Girsch
tgirsch@iname.com
Thomas J. Girsch wrote:
>
> Here's another question for the group: What are the differences between
> these two things:
>
> -- First thing
> CREATE TABLE foo (
> col1 INTEGER,
> col2 INTEGER
> );
> ALTER TABLE foo ADD CONSTRAINT PRIMARY KEY (col1) CONSTRAINT foo_pk;>
> -- Second thing
> CREATE TABLE foo (
> {as above}
> );
> CREATE UNIQUE INDEX foo_ix00 ON foo(col1);
> ALTER TABLE foo ADD CONSTRAINT PRIMARY KEY (col1) CONSTRAINT foo_pk;>
> In the second way, you get to choose the name for the index, and in the
> first way, you don't. But is there anything more subtle than that? That
> is, does an implicitly created index behave any differently than an
> explicitly created one?
Behavior's the same you just get rid of those pesky weird index names.
Art S. Kagel