Re: [HACKERS] Trigger aborted on error

From: "D'Arcy" "J(dot)M(dot)" Cain <darcy(at)druid(dot)net>
To: akorud(at)polynet(dot)lviv(dot)ua (Andrij Korud)
Cc: wieck(at)debis(dot)com, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Trigger aborted on error
Date: 1999-11-01 11:55:16
Message-ID: m11iG3Q-0000bFC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thus spake Andrij Korud
> > The only possibility you have is to check via SELECT prior to
> > the INSERT. Unfortunately you would need an exclusive table
> > lock to avoid race conditions.
> >
> Let's make another question: Is there some way to insert uniq data into
> table without first cheking using SELECT. Because this table contain >1M
> records and SELECT on it is very slow. If there is no way of doing it I
> should consider moving from Postgres to other database :(

Have you put an index on the field in question? It shouldn't matter how
many records you have if you do. If you don't, no other database will
help you any better.

The following declaration will create the field, give it the default
and put a unique index on it. How are you declaring the field now?

CREATE TABLE t (pk SERIAL PRIMARY KEY, ...

--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-11-01 14:52:32 Re: Patch - Re: [HACKERS] view vs. inheritance hierarchy
Previous Message Karel Zak - Zakkr 1999-11-01 09:09:51 Re: Patch - Re: [HACKERS] view vs. inheritance hierarchy