(with SQL Server 2008) I have a big table (~50M records) that is fully normalized. There are 4 primary columns, and one of the them has only three possible entries- A, B, and C. The issue is, often there is much redundancy for this column. That is to say, there can be many records with value A, and then many repeated records that are identical in all respects, except with value B (and/or C). This redundancy does not always happen, but it’s frequent enough that it greatly increases the record count and I wish to be rid of it.
My idea is that instead of A, B, C being choices for a column, I’ve thought about creating 3 bit columns titled A, B, C. Then in the case of the aforementioned redundancies for these values, I don’t have to create repeated records, but instead just have one record and then flag the A, B, and/or C columnns as necessary.
These seems unorthodox so I thought I’d see what the experts think. One thing is that there would be three different uniqueness contraints for this table, each including all the other primary keys plus one of the three flag columns.
[EDIT] To clarify on the meaning of “many repeated records”, one of the other PK’s is a date column. So for example, there could be 1000 records of different dates with entry A, and then another 1000 records of the same dates (and other columns identical) but with entry B. So that is how even with only three choices there can still be lots of redundancy.
How about creating a separate table that stores these “flags”, foreign key’d back to your original table?
Table1 (original table)
———————-
PriKey1 (PK for Table1)
Col1
Col2
Table2 (new table)
——————
PriKey2 (PK for Table2)
PriKey1 (FK to Table1)
A
B
C