X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 03CB39DC9A0 for ; Tue, 20 Dec 2005 11:48:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05894-02 for ; Tue, 20 Dec 2005 11:48:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id EAEC49DC819 for ; Tue, 20 Dec 2005 11:48:05 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jBKFm80H029673; Tue, 20 Dec 2005 10:48:08 -0500 (EST) To: Markus Schaber cc: PostgreSQL Performance List Subject: Re: Read only transactions - Commit or Rollback In-reply-to: <43A7F9B9.3010906@logix-tt.com> References: <16F953410A0F1346848DCB476A989CFE01D6AF@swtexchange2.technology.de> <43A7F303.8040804@logix-tt.com> <87mziwj6na.fsf@gate450.dyndns.org> <43A7F9B9.3010906@logix-tt.com> Comments: In-reply-to Markus Schaber message dated "Tue, 20 Dec 2005 13:31:53 +0100" Date: Tue, 20 Dec 2005 10:48:08 -0500 Message-ID: <29672.1135093688@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.021 required=5 tests=[AWL=0.021] X-Spam-Score: 0.021 X-Spam-Level: X-Archive-Number: 200512/497 X-Sequence-Number: 16318 Markus Schaber writes: > Some time ago, I had some tests with large bulk insertions, and it > turned out that SERIALIZABLE seemed to be 30% faster, which surprised us. That surprises me too --- can you provide details on the test case so other people can reproduce it? AFAIR the only performance difference between SERIALIZABLE and READ COMMITTED is the frequency with which transaction status snapshots are taken; your report suggests you were spending 30% of the time in GetSnapshotData, which is a lot higher than I've ever seen in a profile. As to the original question, a transaction that hasn't modified the database does not bother to write either a commit or abort record to pg_xlog. I think you'd be very hard pressed to measure any speed difference between saying COMMIT and saying ROLLBACK after a read-only transaction. It'd be worth your while to let transactions run longer to minimize their startup/shutdown overhead, but there's a point of diminishing returns --- you don't want client code leaving transactions open for hours, because of the negative side-effects of holding locks that long (eg, VACUUM can't reclaim dead rows). regards, tom lane