Received: from maia.hub.org (maia-1.hub.org [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 621B86322B9 for ; Wed, 5 May 2010 07:37:00 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 63842-06 for ; Wed, 5 May 2010 10:36:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f228.google.com (mail-bw0-f228.google.com [209.85.218.228]) by mail.postgresql.org (Postfix) with ESMTP id 7527663131C for ; Wed, 5 May 2010 07:36:52 -0300 (ADT) Received: by bwz28 with SMTP id 28so2631339bwz.34 for ; Wed, 05 May 2010 03:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=+IuVmvq7XFK8I6FSra9vn9uW2Pv585bmvIbyop8b+2E=; b=Z/3XRNP3Y+IaW8NzHgqMFiFJOdE+je7KCn95MOv5HtP21Q86ctvW2G1o5P2QfHVGqm pknDROT1EF83sF/hLuFgBfwulTsZazy4MD80jqdQd0qL8+DjSE7ym/8/OYBBlc1hgKpj vi4RhrghkO6mme3kznFNWbpFfuMg3ZheH0/S4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=o5TV5mGz7v7BFckSVlH2qkTBc6xvGrnmmcOofgDGY8WV1+7dZUEQJETMbfN7KIe4t0 krV2Q6oKXGT5ypE0AzF+oHDucHaV4li4HULIZcNO9/2fK6pWVW8MMTEwdqjcHjp1+VBT PHeHqsxLL2EvLTS1HGKUez8KVxt54XofVlCOs= Received: by 10.204.21.17 with SMTP id h17mr1539929bkb.197.1273055810650; Wed, 05 May 2010 03:36:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.54.198 with HTTP; Wed, 5 May 2010 03:36:29 -0700 (PDT) In-Reply-To: <7965A9DCF12CC14984420BCC37B1608F25AC1C6612@Elzar.grant.co.uk> References: <7965A9DCF12CC14984420BCC37B1608F25AC1C6612@Elzar.grant.co.uk> From: Ian Lea Date: Wed, 5 May 2010 11:36:29 +0100 Message-ID: Subject: Re: "duplicate key value violates unique constraint" ERROR To: Renato Oliveira Cc: "pgsql-admin@postgresql.org" Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201005/48 X-Sequence-Number: 34521 The most likely cause is surely application error: your application is attempting to insert rows into a table and those new rows have the primary key set to a value that is already present for that table. Could be the app isn't checking properly before doing an insert (or update), could be you are trying to load data twice, could be whatever is generating the data in the first place is generating duplicates, etc. Seems unlikely that the exception itself would cause your system to slow down but whatever is causing the exception (trying to load everything multiple times?) might be. -- Ian. On Wed, May 5, 2010 at 11:22 AM, Renato Oliveira wrote: > Dear all, > > > > I am sorry to have another post. > > I have been following a problem which has been growing fast on our system= . > > > > At the beginning I thought it was related to load on PG server, then I > thought it was load on the switch/network, now I don=92t know. > > > > We seem to get loads of Exception errors and when I look at the Postgres = Log > there are loads of =93duplicate key value violates unique constraint=94 > > > > I have researched on the Internet and some posts say: Reindex, some say b= ug > in JIRA. > > Some say: Your primary key index isn't in sync. > > > > Have you guys suffered from this problem before, or have seen it anywhere= ? > > > > From 30th of April to today I got 1400 errors. > > What do you guys think might cause this behavior? > > I also think it is causing the system to slow down a bit, do you think th= at > might be possible? > > > > Very much appreciate any help, insight, opinion or anything you could thi= nk. > > > > Thank you very much > > > > > > Best regards > > > > Renato > > > > > Renato Oliveira > Systems Administrator > e-mail: renato.oliveira@grant.co.uk > > Tel: +44 (0)1763 260811 > Fax: +44 (0)1763 262410 > www.grant.co.uk > > Grant Instruments (Cambridge) Ltd > > Company registered in England, registration number 658133 > > Registered office address: > 29 Station Road, > Shepreth, > CAMBS SG8 6GB > UK > > > > > > > > P Please consider the environment before printing this email > > CONFIDENTIALITY: The information in this e-mail and any attachments is > confidential. It is intended only for the named recipients(s). If you are > not the named recipient please notify the sender immediately and do not > disclose the contents to another person or take copies. > > VIRUSES: The contents of this e-mail or attachment(s) may contain viruses > which could damage your own computer system. Whilst Grant Instruments > (Cambridge) Ltd has taken every reasonable precaution to minimise this ri= sk, > we cannot accept liability for any damage which you sustain as a result o= f > software viruses. You should therefore carry out your own virus checks > before opening the attachment(s). > > OpenXML: For information about the OpenXML file format in use within Gran= t > Instruments please visit our website