triggers and indexes. - Mailing list pgsql-novice

From Tom Larard
Subject triggers and indexes.
Date
Msg-id Pine.GSO.4.21.0103011448400.12433-100000@u5.cs.umb.edu
Whole thread Raw
List pgsql-novice
I have a database in a suitable format to use COPY TO to import. As it
contains 4million records I have dropped both the primary key (because it
creates an index), and the referential integrity triggers. I do this by
just creating the tables without primary keys or triggers. The problem is
that although I can happily now import the data in a very quick time, (<2
hrs) I now need to read the primary key and the referential integrity
triggers.

This is the table I use as I need to import data...
create table discid (
        discID            varchar(8),
        CDID              integer not null
)

This is what I really need as a table....
create table discid (
        discID            varchar(8),
        CDID              integer not null REFERENCES cds (cdid),
    PRIMARY KEY      (discID)
)

Does anyone know how to create a trigger that is the same as that created
by postgres to enforce referential integrity? and put an index on CDID
later is not the same as having an indexed primary key, hoe can I do that?

Many thanks in advance.

Tom Larard





pgsql-novice by date:

Previous
From: Hector Diaz
Date:
Subject: Re: text field size
Next
From: GH
Date:
Subject: Re: Backing up with Postgres