Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id CBE28635430 for ; Tue, 2 Feb 2010 15:04:56 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 13288-01-9 for ; Tue, 2 Feb 2010 19:04:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-px0-f194.google.com (mail-px0-f194.google.com [209.85.216.194]) by mail.postgresql.org (Postfix) with ESMTP id 32D9D634704 for ; Tue, 2 Feb 2010 14:59:05 -0400 (AST) Received: by mail-px0-f194.google.com with SMTP id 32so359180pxi.15 for ; Tue, 02 Feb 2010 10:59:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=/pGwcSYpVF1RWJtbTDi6M4F9E6ebBERGr1vzIDbNO3w=; b=NeDRjhQuzqso91p7jRoNghkPmS/kBZtlFW7n9hdycnZbAsfoD2k1bLRyqU/fl3+EGm vwQ+BQ0107EcAF7Itr7OBDy47v/oT9AwEmuv3bXTOx4KUtas6tqi7nnDfuWo1WcHEETg 9+D+VF95JMzppCntVtj3p6Rkd6e6sRAD/WnW4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=mww73MnOS4EfA7+zt0wlLHFDfsH+E36ufA0xlY89h42N/y/sOnbHrx+65jERpY4jn/ /ab1kJ/VKAL/twYiD2dNkjhP0MYSnmf8j72HWT717tWMpY1A86490kPNqG5X8fn0867m 6BrUKhvrEXoXAIbd1MemmYomQpw3JUcldPaRY= MIME-Version: 1.0 Received: by 10.141.187.13 with SMTP id o13mr4167220rvp.28.1265126953395; Tue, 02 Feb 2010 08:09:13 -0800 (PST) In-Reply-To: <20100202043959.7C1354B1C26@mail175-236.sinamail.sina.com.cn> References: <20100202043959.7C1354B1C26@mail175-236.sinamail.sina.com.cn> From: Greg Stark Date: Tue, 2 Feb 2010 16:08:53 +0000 X-Google-Sender-Auth: 666ca82d619ac744 Message-ID: <407d949e1002020808s4235a7d6p541029ead3cab629@mail.gmail.com> Subject: Re: use pgsql in a big project, but i found pg has some big problem on concurrency write operation, maybe a joke for myself ! To: wyx6fox@sina.com Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.11 tagged_above=-10 required=5 tests=BAYES_05=-1.11 X-Spam-Level: X-Archive-Number: 201002/21 X-Sequence-Number: 37442 2010/2/2 : > UPDATE webpages SET hits =3D hits + 1 WHERE url =3D'some url '; > > =A0when concurrency write transaction on read committed isolation , the h= its > may result wrong . That should work fine. All updates for the same url will be serialized. The rest I'm pretty uncertain about what you're describing but I think you may want to check about whether you need indexes on the other side of your foreign key constraints. If you're deleting records that are referred to by your foreign keys or you're updating the primary key then you'll want this index on the table with the foreign key constraint as well as the mandatory one on the referenced table. --=20 greg