Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XAJbx-0001o9-Q6 for pgsql-performance@arkaria.postgresql.org; Thu, 24 Jul 2014 14:03:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XAJbw-0006X6-Vs for pgsql-performance@arkaria.postgresql.org; Thu, 24 Jul 2014 14:03:09 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XAJbv-0006Ww-TQ for pgsql-performance@postgresql.org; Thu, 24 Jul 2014 14:03:08 +0000 Received: from nm29-vm4.bullet.mail.ne1.yahoo.com ([98.138.91.189]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XAJbq-0004QP-MF for pgsql-performance@postgresql.org; Thu, 24 Jul 2014 14:03:06 +0000 Received: from [98.138.226.180] by nm29.bullet.mail.ne1.yahoo.com with NNFMP; 24 Jul 2014 14:03:00 -0000 Received: from [98.138.89.162] by tm15.bullet.mail.ne1.yahoo.com with NNFMP; 24 Jul 2014 14:03:00 -0000 Received: from [127.0.0.1] by omp1018.mail.ne1.yahoo.com with NNFMP; 24 Jul 2014 14:03:00 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 141720.22144.bm@omp1018.mail.ne1.yahoo.com Received: (qmail 84266 invoked by uid 60001); 24 Jul 2014 14:03:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1406210580; bh=8n70ieIAHcEKK7q459TfqQw5j/lmuPEHzLpA7q5hWMI=; h=References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=yICiIbyJF7GVC1hK9tzrk78Y0HVxjXyEtKpxlVerLahRRZGdX2acmP+C+6zM+wuOKxy+zAogn7AP0NTz6vO/v2YIcoRQJsvwNna2cUpKvjlVLdzEEgilTodyNzBhTAtfPX5FIXVb6QrAjQoFlj0oVx5Lvetw5j+f+TYqqrvbZSA= X-YMail-OSG: hj1NAKAVM1l9VWBNfeO0.8rjxjNUd3sjGbXQuv8LPLS2LuF lO4k2CoZffUU3THjnDRRBi1DPGwNEpInudESOk_KNByP44z92RAoH8qa9KOS a7oMIrYG6InFXrb9yRgyaB_qoRh2gXXyeuBjBCPt0QSdq3S6DaymclEY_AeY PV4DjHzYBk_.r17W.Mjl87slTvr56MAF.HHLXXrILW3aCfHx2nf.RHHMRGxD H.P4YUlDPY7NaXC0nIwfn9WxGUFKhAMtydXuZDtYSMsrRHkgzGoj_nKzrR8M RvELxCajj.xzwCmasHylcwQO.YWb4XKBIrli61SK4L94q6xgaDfjGgaXAMpN 8pNNo0iQE.SbdnHdumIrs4JeuPFH8wGLszBd1du_AyAvdoqGZsm6h9hRKm1P p7nTpxysbwggYgPPHWdWWZk5CQe4tJJUb9CtN2r2TbAdVKr0WOLi5GGfOV7h J.QESt4XDsbnrjt23UEUBhGksXPRczsUjtfosoML.P.11KWt4PhtwsKitJDR kZ53u_CfOnN8P91VkFonoXuDAO3Phnt1P6nX6HUaGB_OK0EiiDLNJ_2dYSlg _CT31eB7lFX_xxht2YUi8k0se0bmfaTt31.auKx.rLQzksN8LtLzvi0d0bPa OTAW6eCB0AYGA9N2_pB0Zj6yfdNJTT9Hq2qzXf4Pku0mvj3Sg9X.rLIukIUi osxwF67mOAPK4lUiQlqBlwTxpmL4e6NMO8Kf98ul3mDbcDPPF3ql5OftOF1U FehezEz7tqwyb0U2G1hwS Received: from [24.178.25.147] by web122301.mail.ne1.yahoo.com via HTTP; Thu, 24 Jul 2014 07:02:59 PDT X-Rocket-MIMEInfo: 002.001, UmV6YSBUYWhlcmkgPHJ0YWhlcmlAdm13YXJlLmNvbT4gd3JvdGU6Cgo.IEkgYW0gcnVubmluZyBpbnRvIHZlcnkgaGlnaCBmYWlsdXJlIHJhdGVzIHdoZW4gSSBydW4gd2l0aCB0aGUKPiBTZXJpYWxpemFibGUgSXNvbGF0aW9uIExldmVsLiBJIGhhdmUgc2ltcGxpZmllZCBvdXIgY29uZmlndXJhdGlvbgo.IHRvIGEgc2luZ2xlIGRhdGFiYXNlIHdpdGggYSBjb25zdGFudCB3b3JrbG9hZCwgYSBUUEMtRSB3b3JrbG9hZAo.IGlmIHlvdSB3aWxsLCB0byBmb2N1cyBvbiB0aGlzIHRoaXMgcHJvYmxlbS4gV2UgYXIBMAEBAQE- X-Mailer: YahooMailWebService/0.8.196.685 References: Message-ID: <1406210579.67466.YahooMailNeo@web122301.mail.ne1.yahoo.com> Date: Thu, 24 Jul 2014 07:02:59 -0700 From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: High rate of transaction failure with the Serializable Isolation Level To: Reza Taheri , "pgsql-performance@postgresql.org" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Reza Taheri wrote: > I am running into very high failure rates when I run with the > Serializable Isolation Level. I have simplified our configuration > to a single database with a constant workload, a TPC-E workload > if you will, to focus on this this problem. We are running with > PGSQL 9.2.4 I don't remember any bug fixes that would be directly related to what you describe in the last 15 months, but it might be better to do any testing with fixes for known bugs: http://www.postgresql.org/support/versioning/ > When we raise the Trade-Result transaction to > SQL_TXN_SERIALIZABLE, we face a storm of conflicts. Out of > 37,342 Trade-Result transactions, 15,707 hit an error, and have > to be rolled back and retired one or more times. The total > failure count (due to many transactions failing more than once) > is 31,388. > > What is unusual is that the majority of the failures occur in a > statement that should not have any isolation conflicts. As already pointed out by Craig, statements don't have serialization failures; transactions do.=A0 In some cases a transaction may become "doomed to fail" by the action of a concurrent transaction, but the actual failure cannot occur until the next statement is run on the connection with the doomed transaction; it may have nothing to do with the statement itself. If you want to understand the theory of how SERIALIZABLE transactions are implemented in PostgreSQL, these links may help: http://vldb.org/pvldb/vol5/p1850_danrkports_vldb2012.pdf http://git.postgresql.org/gitweb/?p=3Dpostgresql.git;a=3Dblob_plain;f=3Dsrc= /backend/storage/lmgr/README-SSI;hb=3Dmaster http://wiki.postgresql.org/wiki/Serializable For a more practical set of examples about the differences in using REPEATABLE READ and SERIALIZABLE transaction isolation levels in PostgreSQL, see: http://wiki.postgresql.org/wiki/SSI If you are just interested in reducing the number of serialization failures, see the suggestions near the end of this section of the documentation: http://www.postgresql.org/docs/9.2/interactive/transaction-iso.html#XACT-SE= RIALIZABLE Any of these items (or perhaps a combination of them) may ameliorate the problem.=A0 Note that I have seen reports of cases where max_pred_locks_per_transaction needed to be set to 20x the default to reduce serialization failures to an acceptable level. The default is intentionally set very low because so many people do not use this isolation level, and this setting reserves shared memory for purposes of tracking serializable transactions; the space is wasted for those who don't choose to use them. There is still a lot of work possible to reduce the rate of false positives, which has largely gone undone so far due to a general lack of problem reports from people which could not be solved through tuning.=A0 If you have such a case, it would be interesting to have all relevant details, so that we can target which of the many enhancements are relevant to your case. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance