Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 7E5B52E0082 for ; Sat, 15 Dec 2007 03:33:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 38722-07 for ; Sat, 15 Dec 2007 03:32:51 -0400 (AST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.183]) by postgresql.org (Postfix) with ESMTP id A7A002E0065 for ; Sat, 15 Dec 2007 03:32:52 -0400 (AST) Received: by wa-out-1112.google.com with SMTP id m38so1966028waf.5 for ; Fri, 14 Dec 2007 23:32:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=v8VsMkK43iZmNhyzwa5Yi2TyGXdEzFqNRsMk0bLg5Qk=; b=nOVjudjvC4PnJHVkXi6WowN1y298ZIDEG8QJR0dNoCot4kdyLK17Z5/2uBcAeHcFSFCfgU4pZhiUEB+xBajFgZbbJ2PhUcFS4LhuksNmUKCPmPgyGGUS4dvG58ZQUKu13Cfzk6udh6ldVcAkoCAfQk3ilmAjg+HaYth4AORiXeA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=Goy0sfvAAkXdvnEhDgOHHRUSIRPsmwJhUNik/o+GK1XcrTTErGQryJmOfxJ0NlM1AO6LT5P0hm1d0vFcjzFjUlTSic7Ztpz+gMe4t0saK+MvEol3bJcsI+v4euCWAncQ1oKYPirCUCrvesNdiqiKUEs9EAmYGw7wOX80YGrTfcA= Received: by 10.143.34.11 with SMTP id m11mr2038250wfj.222.1197703971103; Fri, 14 Dec 2007 23:32:51 -0800 (PST) Received: by 10.142.90.16 with HTTP; Fri, 14 Dec 2007 23:32:51 -0800 (PST) Message-ID: Date: Sat, 15 Dec 2007 13:02:51 +0530 From: NikhilS To: "Neil Conway" Subject: Re: VLDB Features Cc: "Tom Lane" , "Hannu Krosing" , "Josh Berkus" , pgsql-hackers@postgresql.org, "Simon Riggs" In-Reply-To: <1197677930.1536.18.camel@dell.linuxdev.us.dell.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4228_10971707.1197703971110" References: <1197371508.4255.1327.camel@ebony.site> <200712111053.11178.josh@agliodbs.com> <1197416461.29432.10.camel@dell.linuxdev.us.dell.com> <1197636530.7974.16.camel@hannu-laptop> <1197660423.1536.8.camel@dell.linuxdev.us.dell.com> <15007.1197674561@sss.pgh.pa.us> <1197677930.1536.18.camel@dell.linuxdev.us.dell.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/585 X-Sequence-Number: 111874 ------=_Part_4228_10971707.1197703971110 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, > > Another approach would be to distinguish between errors that require a > subtransaction to recover to a consistent state, and less serious errors > that don't have this requirement (e.g. invalid input to a data type > input function). If all the errors that we want to tolerate during a > bulk load fall into the latter category, we can do without > subtransactions. > I think errors which occur after we have done a fast_heap_insert of the tuple generated from the current input row are the ones which would require the subtransaction to recover. Examples could be unique/primary key violation errors or FKey/triggers related errors. Any errors which occur before doing the heap_insert should not require any recovery according to me. The overhead of having a subtransaction per row is a very valid concern. But instead of using a per insert or a batch insert substraction, I am thinking that we can start off a subtraction and continue it till we encounter a failure. The moment an error is encountered, since we have the offending (already in heap) tuple around, we can call a simple_heap_delete on the same and commit (instead of aborting) this subtransaction after doing some minor cleanup. This current input data row can also be logged into a bad file. Recall that we need to only handle those errors in which the simple_heap_insert is successful, but the index insertion or the after row insert trigger causes an error. The rest of the load then can go ahead with the start of a new subtransaction. Regards, Nikhils -- EnterpriseDB http://www.enterprisedb.com ------=_Part_4228_10971707.1197703971110 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi,

Another approach would be to distinguish between errors that require a
subtransaction to recover to a consistent state, and less serious errors
that don't have this requirement (e.g. invalid input to a data type
input function). If all the errors that we want to tolerate during a
bulk load fall into the latter category, we can do without
subtransactions.
 
I think errors which occur after we have done a fast_heap_insert of the tuple generated from the current input row are the ones which would require the subtransaction to recover. Examples could be unique/primary key violation errors or FKey/triggers related errors. Any errors which occur before doing the heap_insert should not require any recovery according to me.
 
The overhead of having a subtransaction per row is a very valid concern. But instead of using a per insert or a batch insert substraction, I am thinking that we can start off a subtraction and continue it till we encounter a failure. The moment an error is encountered, since we have the offending (already in heap) tuple around, we can call a simple_heap_delete on the same and commit (instead of aborting) this subtransaction after doing some minor cleanup. This current input data row can also be logged into a bad file. Recall that we need to only handle those errors in which the simple_heap_insert is successful, but the index insertion or the after row insert trigger causes an error. The rest of the load then can go ahead with the start of a new subtransaction.
 
Regards,
Nikhils
--
EnterpriseDB               http://www.enterprisedb.com ------=_Part_4228_10971707.1197703971110--