Re: Foreign Keys

From: Neil Conway <neilc(at)samurai(dot)com>
To: "Adam T(dot) Gautier" <adam_gautier(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Foreign Keys
Date: 2002-09-25 00:55:11
Message-ID: 87ofamzy4w.fsf@mailbox.samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Adam T. Gautier" <adam_gautier(at)yahoo(dot)com> writes:
> CREATE TABLE subjects (
>      id SERIAL PRIMARY KEY,
>      type VARCHAR(3) NOT NULL,
>      status SMALLINT NOT NULL,
>      selectable BOOLEAN DEFAULT true,
>      parent_id BIGINT REFRENCES subjects( id ),
>      subject VARCHAR(255) NOT NULL,
>      description TEXT NOT NULL,
>      childcount BIGINT DEFAULT 0,
>      eurekacount BIGINT DEFAULT 0,
>      path TEXT NOT NULL UNIQUE,
>      updated BIGINT NOT NULL );

Why is parent_id an int8, while id is only an int4? If you change the
types to match (either parent_id -> int4, or id -> bigserial), I'd bet
you'd see a lot better performance.

Cheers,

Neil

--
Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2002-09-25 01:19:46 Re: Error at startup
Previous Message Joe Conway 2002-09-25 00:50:10 Re: Foreign Keys