A select on a unique index should be very fast.
Maybe you have forgotten to run VACUUM ANALYZE...?
/Mattias
----- Original Message -----
From: "Benoit Baudouin" <benoit.baudouin@b2i-toulouse.com>
To: <pgsql-general@postgresql.org>
Sent: Monday, June 16, 2003 5:25 PM
Subject: [GENERAL] trigger interruption on "SPI_execp"
> hi,
>
> I table with primary key and in trigger try to insert into this table data
> wich violate constrain (not uniq). When ectually executing SPI_execp I got
> a message "ERROR: cannot insert a duplicate key into a unique index" and
> trigger executing is aborted.
> 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.
>
> best regards,
>
> Benoît Baudouin
>
> B2i Toulouse
> 1 av. de l'Europe 31400 Toulouse
> tel 0561003080 fax 0561003085
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>