Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id C90E263432C for ; Wed, 3 Feb 2010 11:18:11 -0400 (AST) 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 31204-04-3 for ; Wed, 3 Feb 2010 15:17:51 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ews43.everyware.ch (ews43.everyware.ch [212.71.111.43]) by mail.postgresql.org (Postfix) with ESMTP id 1EB8363358D for ; Wed, 3 Feb 2010 11:16:37 -0400 (AST) Received: from mars.lemaco.ch [212.71.105.68] by ews43.everyware.ch with ESMTP (SMTPD32-8.15) id A34F4B200108; Wed, 03 Feb 2010 16:16:31 +0100 Message-ID: <4B69934E.6060606@beecom.ch> Date: Wed, 03 Feb 2010 16:16:30 +0100 From: Leo Mannhart User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: wyx6fox@sina.com CC: pgsql-performance@postgresql.org Subject: Re: some problems when i use postgresql 8.4.2 in my projects . References: <20100203022830.2A375358C60@mail175-236.sinamail.sina.com.cn> In-Reply-To: <20100203022830.2A375358C60@mail175-236.sinamail.sina.com.cn> Content-Type: text/plain; charset=x-gbk Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.299 tagged_above=-10 required=5 tests=AWL=-1.300, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 201002/59 X-Sequence-Number: 37480 wyx6fox@sina.com wrote: > after shaming , I think i should pick out some my points: > the unique constraints actualy kill concurrency write transaction when > concurrency insert violate the unique constraints , they block each > other , i test this in oracle10g, has the same behavour. I think this > may be reasonable because the uqniue check must be the seriazable check . > for resolve this problem , i do the unique check in application as > possible , but in big concurrency env , this is not good way . > How can you enforce uniqueness in the application? If you implement it correctly, you need considerably longer than letting it do PostgreSQL. Even if you use some kind of magic, I could not imagine, how you can implement a unique constraint in the application and gaurantee uniqueness while at the same time be faster than the RDBMS. Leo