Subject Optimizing and normalizing the DB
Author Michael Vilhelmsen
Hi

After this years conference in Prague (great conference BTW) I'm
trying to optimize our database. And in some extend normalize it.

But doing this have raised some questions.
I'll just take them from top down.


1.
I have a table.
This table is defined as:

CREATE TABLE VAREFRVSTR (
VAREPLU_ID VARCHAR(30) NOT NULL,
FARVE_NAVN VARCHAR(30) NOT NULL,
LAENGDE_NAVN VARCHAR(30) NOT NULL,
STOERRELSE_NAVN VARCHAR(30) NOT NULL,
V509INDEX VARCHAR(30) DEFAULT ''
... some more fields
);

At this point the PK is

ALTER TABLE VAREFRVSTR ADD PRIMARY KEY (VAREPLU_ID, FARVE_NAVN,
LAENGDE_NAVN, STOERRELSE_NAVN);

So its actually build from 4 varchar(30) fields.

Would I benefit from adding a new field called ID which is an integer,
and have this updated via a trigger and a generator ?



2.
Can I drop a PK if it isn't being referenced anywhere ?



3.
If my PK has references, should I then change the table that
references this PK to reference my new PK instead ?



4.
Ann talked about optimizing the DB in Praque.
She talked something about an index shouldn't have to many dublicate
values.
This I understood, and are about to drop some index (also that an
index is only use to retreive records. Not sorting).

But a FK can be seen as an "Index".
This can sometimes have a bad selectivity.
So should this FK be redefined ?



I think thats it for now.


Michael