Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 86501 invoked from network); 11 Mar 2005 16:25:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 Mar 2005 16:25:33 -0000 Received: (qmail 65007 invoked by uid 500); 11 Mar 2005 16:25:31 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 64984 invoked by uid 500); 11 Mar 2005 16:25:31 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 64970 invoked by uid 99); 11 Mar 2005 16:25:31 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from mail.seitenbau.net (HELO mail.seitenbau.net) (194.175.229.106) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 11 Mar 2005 08:25:30 -0800 Received: from [195.127.188.18] (helo=www.seitenbau.net) by router1.seitenbau.net with esmtp (Exim 4.43) id 1D9mx5-0006tK-Sj for torque-user@db.apache.org; Fri, 11 Mar 2005 17:25:27 +0100 In-Reply-To: <1592218F4C3EED4FBEAC48F9160FE60F15E7941F@nycexmb09.pfizer.com> Subject: RE: inefficient doDelete To: "Apache Torque Users List" X-Mailer: Lotus Notes Release 6.0 September 26, 2002 Message-ID: From: Thomas Fischer Date: Fri, 11 Mar 2005 17:25:27 +0100 X-MIMETrack: Serialize by Router on www/seitenbau(Release 6.5.1|January 21, 2004) at 11.03.2005 05:25:27 PM MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N "Husek, Paul" schrieb am 11.03.2005 17:01:45: > I've been using Torque for almost a year now and am very happy with it. > Recently though I found something that confuses me. > > > > All along I've been deleting all History books like: > > > > Criteria c=new Criteria(); > > c.add(BookPeer.TYPE,"HISTORY"); > > BookPeer.doDelete(c) > > > > And it works fine. But recently I tried this when there over 100,000 > history books. I was greeted with a java "out of memory" error. Is Torque > trying to load all records before deleting each of them? Yes, it does. Code form BasePeer.doDelete(Criteria criteria, Connection con) tds.where(sqlSnippet); tds.fetchRecords(); if (tds.size() > 1 && criteria.isSingleRecord()) { handleMultipleRecords(tds); } for (int j = 0; j < tds.size(); j++) { Record rec = tds.getRecord(j); rec.markToBeDeleted(); rec.save(); } > Why would it? I am not sure about this. It seems than in its early days, Torque has relied a lot on the village library and this is the way village handles deletes. Not a convincing explanation,though. Perhaps some old Torque guru can think of another reason... > Is there a work around? > I can think of two things: either patch Torque or create the SQL yourself and use executeStatement(String). I will ask on the dev list if anybody can think of a reason why the records are loaded before they are deleted. If nobody has a reason for it, chances are good that it will be changed. Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org