Home > Archive > PostgreSQL SQL > March 2006 > Constraint Error effect on PostgreSQL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Constraint Error effect on PostgreSQL
Christian Paul B. Cosinas

2006-03-13, 7:25 am

Hi Fellow PostgreSQL users,

Just a question here.

Is there any bad effect on the PostgreSQL performance If I encounter many
fails on inserting records to database with primary key column.

For example I have this table

CREATE TABLE unique_items
(
item_id text NOT NULL,
CONSTRAINT unique_items_pkey PRIMARY KEY (item_id),
CONSTRAINT unique_item_id_fk FOREIGN KEY (item_id)
REFERENCES items (item_id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
)
WITH OIDS;

With these valu:

Unique items
------------
Item001

Then I have a program that insert 1(one) million times like this:
Insert into unique_items(item_id
) values('Item001)

Ofcourse we all know that it will fail because there is already a record in
the database.

Would there be any bad effect on the database or none?

Regards,
Ian


I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Richard Huxton

2006-03-13, 1:24 pm

Christian Paul B. Cosinas wrote:
>
> Then I have a program that insert 1(one) million times like this:
> Insert into unique_items(item_id
) values('Item001)
>
> Ofcourse we all know that it will fail because there is already a record in
> the database.
>
> Would there be any bad effect on the database or none?


No long-term effects. Obviously it takes time to run one million queries
even if they are all inserts that fail.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com