Removing foreign key and adding sequence

From: "Chad Thompson" <chad(at)weblinkservices(dot)com>
To: "pgsql-novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Removing foreign key and adding sequence
Date: 2003-06-26 17:07:47
Message-ID: 000901c33c05$781aa120$32021aac@chad
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2003-06-26 17:12:18 Re: Removing foreign key and adding sequence
Previous Message Herbie McDuck 2003-06-26 16:58:57 Re: Incremental Dump