X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 3380C9FA5FC for ; Thu, 27 Jul 2006 15:41:05 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 37921-09-2 for ; Thu, 27 Jul 2006 15:40:54 -0300 (ADT) X-Greylist: delayed 01:09:03.037097 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 4FD149FB233 for ; Thu, 27 Jul 2006 15:40:16 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by svr4.postgresql.org (Postfix) with ESMTP id D792B5AF035 for ; Thu, 27 Jul 2006 17:30:11 +0000 (GMT) Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 27 Jul 2006 10:19:15 -0700 Subject: Savepoint performance From: Mark Lewis To: pgsql-performance@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Thu, 27 Jul 2006 10:19:15 -0700 Message-Id: <1154020755.1634.509.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-27) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.24 tagged_above=0 required=5 tests=AWL, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200607/246 X-Sequence-Number: 20106 All, I support a system that runs on several databases including PostgreSQL. I've noticed that the other DB's always put an implicit savepoint before each statement executed, and roll back to that savepoint if the statement fails for some reason. PG does not, so unless you manually specify a savepoint you lose all previous work in the transaction. So my question is, how expensive is setting a savepoint in PG? If it's not too expensive, I'm wondering if it would be feasible to add a config parameter to psql or other client interfaces (thinking specifically of jdbc here) to do it automatically. Doing so would make it a little easier to work with PG in a multi-db environment. My main reason for wanting this is so that I can more easily import, say, 50 new 'objects' (related rows stored across several tables) in a transaction instead of only one at a time without fear that an error in one object would invalidate the whole batch. I could do this now by manually setting savepoints, but if it's not a big deal performance-wise to modify the JDBC driver to start an anonymous savepoint with each statement, then I'd prefer that approach as it seems that it would make life easier for other folks too. Thanks in advance for any feedback :) -- Mark Lewis