"Adam T. Gautier" <adam_gautier@yahoo.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@samurai.com> || PGP Key ID: DB3C29FC