Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id EC37E2E0371 for ; Fri, 14 Dec 2007 21:04:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 45136-05 for ; Fri, 14 Dec 2007 21:04:03 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 1070A2E0366 for ; Fri, 14 Dec 2007 21:04:02 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id lBF13ujV016877; Fri, 14 Dec 2007 20:03:56 -0500 (EST) To: Neil Conway cc: Hannu Krosing , Josh Berkus , pgsql-hackers@postgresql.org, Simon Riggs Subject: Re: VLDB Features In-reply-to: <1197677930.1536.18.camel@dell.linuxdev.us.dell.com> 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> Comments: In-reply-to Neil Conway message dated "Fri, 14 Dec 2007 16:18:50 -0800" Date: Fri, 14 Dec 2007 20:03:56 -0500 Message-ID: <16876.1197680636@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/579 X-Sequence-Number: 111868 Neil Conway writes: > One approach would be to essentially implement the pg_bulkloader > approach inside the backend. That is, begin by doing a subtransaction > for every k rows (with k = 1000, say). If you get any errors, then > either repeat the process with k/2 until you locate the individual > row(s) causing the trouble, or perhaps just immediately switch to k = 1. > Fairly ugly though, and would be quite slow for data sets with a high > proportion of erroneous data. You could make it self-tuning, perhaps: initially, or after an error, set k = 1, and increase k after a successful set of rows. > 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 such an approach is doomed to hopeless unreliability. There is no concept of an error that doesn't require a transaction abort in the system now, and that doesn't seem to me like something that can be successfully bolted on after the fact. Also, there's a lot of bookkeeping (eg buffer pins) that has to be cleaned up regardless of the exact nature of the error, and all those mechanisms are hung off transactions. regards, tom lane