X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5D640D1B525 for ; Fri, 24 Oct 2003 18:23:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 46294-08 for ; Fri, 24 Oct 2003 15:22:49 -0300 (ADT) Received: from mail.hive.nj2.inquent.com (mc.carriermail.com [205.178.180.9]) by svr1.postgresql.org (Postfix) with SMTP id E2E8FD1B52B for ; Fri, 24 Oct 2003 15:22:47 -0300 (ADT) Received: (qmail 18656 invoked from network); 24 Oct 2003 18:23:08 -0000 Received: from unknown (HELO ?10.0.2.9?) (216.208.117.7) by 205.178.180.9 with SMTP; 24 Oct 2003 18:23:08 -0000 Subject: Re: Performance Concern From: Rod Taylor To: john@pagakis.com Cc: Postgresql Performance In-Reply-To: References: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-PQqIzLhxzDqOUYXY7DU4" Message-Id: <1067019762.81651.64.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Fri, 24 Oct 2003 14:22:42 -0400 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/628 X-Sequence-Number: 4376 --=-PQqIzLhxzDqOUYXY7DU4 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Thu, 2003-10-23 at 08:21, John Pagakis wrote: > Greetings. >=20 > I have a table that will require 100,000 rows initially. >=20 > Assume the following (some of the field names have been changed for > confidentiality reasons): >=20 > CREATE TABLE baz ( > baz_number CHAR(15) NOT NULL, > customer_id CHAR(39), > foobar_id INTEGER, > is_cancelled BOOL DEFAULT false NOT NULL, > create_user VARCHAR(60) NOT NULL, > create_datetime TIMESTAMP DEFAULT 'now()' NOT NULL, > last_update_user VARCHAR(60) NOT NULL, > last_update_datetime TIMESTAMP DEFAULT 'now()' NOT NULL, > CONSTRAINT PK_baz PRIMARY KEY (baz_number) > ); >=20 > ALTER TABLE baz > ADD FOREIGN KEY (customer_id) REFERENCES purchase (customer_id); >=20 > ALTER TABLE baz > ADD FOREIGN KEY (foobar_id) REFERENCES foobar (foobar_id); >=20 >=20 > Using JDBC, it took approximately one hour to insert 100,000 records. I > have an algorithm to generate a unique baz_number - it is a mixture of al= pha > and numerics. Using an int for identification is certainly suggested, however it sounds like you may be short a few indexes on the foreign key'd fields. EXPLAIN ANALYZE output is always nice.. --=-PQqIzLhxzDqOUYXY7DU4 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQA/mW3x6DETLow6vwwRAtQ3AJ9lePqlsCWUWdrYy7CcwsHSsjxcDQCfZdiT xDGojCdM5Toku/EbJgPO3V0= =/Q3s -----END PGP SIGNATURE----- --=-PQqIzLhxzDqOUYXY7DU4--