Removing foreign key and adding sequence - Mailing list pgsql-novice

From Chad Thompson
Subject Removing foreign key and adding sequence
Date
Msg-id 000901c33c05$781aa120$32021aac@chad
Whole thread Raw
Responses Re: Removing foreign key and adding sequence
List pgsql-novice
I have a table of 12 M records.  When this table was created a specific
foreign key constraint was very necessary to ensure the data was correct.  I
have now built enough checks through software that this foreign key is
hindering performance more than it is useful.

So my idea is this.

alter table lists rename to lists_bak;

select * from lists_bak into lists;

I can add the constraints and foreign key's back in that ARE necessary, my
only worry (and mabey you can think of another worry) is that my sequence is
no longer attached to the id field of my table.

Is this the right approach, and if so, how do I add my sequence back in?

#select version();
                                                 version
----------------------------------------------------------------------------
-----------------------------
 PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2
20020903 (Red Hat Linux 8.0 3.2-7)

TIA
Chad


pgsql-novice by date:

Previous
From: Nabil Sayegh
Date:
Subject: Re: Incremental Dump
Next
From: Josh Berkus
Date:
Subject: Re: Removing foreign key and adding sequence