X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B6F2953DA7 for ; Thu, 14 Apr 2005 13:52:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13755-01 for ; Thu, 14 Apr 2005 16:52:33 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 5F7A453CAC for ; Thu, 14 Apr 2005 13:52:33 -0300 (ADT) Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j3EGljma013709; Thu, 14 Apr 2005 09:47:45 -0700 Message-ID: <425E9FD1.3090104@commandprompt.com> Date: Thu, 14 Apr 2005 09:52:33 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: jing han Cc: pgsql-interfaces@postgresql.org Subject: Re: questions about transaction and rollback References: <20050414154800.85174.qmail@web53505.mail.yahoo.com> In-Reply-To: <20050414154800.85174.qmail@web53505.mail.yahoo.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.027 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/57 X-Sequence-Number: 5473 jing han wrote: >Hello, > >I have questions about transaction and rollback. > >Question 1: >In the postgresql.conf file of our running system, >autocommit=true. If leave it as true, can we disable >this attribute when we issue a connection to database? > From the DBD::Pg documentation: The transaction behavior is now controlled with the attribute AutoCommit. For a complete definition of AutoCommit please refer to the DBI documentation. According to the DBI specification the default for AutoCommit is TRUE. In this mode, any change to the database becomes valid immediately. Any ’begin’, ’commit’ or ’rollback’ statement will be rejected. If AutoCommit is switched-off, immediately a transaction will be started by issuing a ’begin’ statement. Any ’commit’ or ’rollback’ will start a new transaction. A disconnect will issue a ’rollback’ statement. > > >Question 2: > >If we use the following command to restore database. >system("su -l postgres -c \"psql -d dbname -f >/tmp/db_dump\""); > >Can command psql rollback if in the middle of restore >power failure happens? > If the db_dump file starts with a transaction yes. > > >Question 3: > >During restore, if power failure happens, we want to >rollback everything having been inserted or updated to >database. In another word, if we are restoring a >database with thousands of turples changes, at the >time, we restore the last turple, power failure >happens, we want to rollback. Can postgres support >huge data changes in one transaction block? > Yes. > How to >configure the limit of how much we can do in one >transaction block? > That would be controlled by issuing multiple transactions. > > >Hope to hear from you soon and thank you in advance. > Sincerely, Joshua D. Drake > > >Best Regards > >jing > > > >__________________________________ >Do you Yahoo!? >Yahoo! Small Business - Try our new resources site! >http://smallbusiness.yahoo.com/resources/ > >---------------------------(end of broadcast)--------------------------- >TIP 8: explain analyze is your friend >