I was planning a similar test to get some sense of the quantifiable difference but you did a great job, Dave! The verdict is in and ‘Insert into’ wins hands down!
That’s what happens when you dangle Foxpro problems in this group. It’s like bait we can’t resist! Thanks! Paul Sent from my iPhone > On Apr 12, 2018, at 11:49 AM, Dave Crozier <[email protected]> wrote: > > Paul, > I have been interested in testing this out myself, so in the interests of all > I just ran a test inserting a 2,000,000 record table into another table with > an integer PK index and a 20 character index (ID field) and the SQL Insert > runs 75% quicker but only 25% quicker if the "select(" (suggested by Alan) > for the inserted records is either a physical table or a readwrite cursor. > > I suppose this confirms that using cursors to pre-fetch your data into memory > is significantly faster for insertions as the required records are either in > memory completely or filtered by VFP. As we all know making a cursor > readwrite effectively makes a cursor perform the same as a physical table as > it causes VFP to create a physical "table" which would appear to > significantly degrade performance - understandable. > > Hope this makes sense... have to go, made myself late for dinner, so if not > I'll explain better tomorrow!! > > Dave Crozier > Software Development Manager > Flexipol Packaging Ltd. > > > > --------------------------------------------------------------- > This communication and the information it contains is intended for the person > or organisation to whom it is addressed. Its contents are confidential and > may be protected in law. If you have received this e-mail in error you must > not copy, distribute or take any action in reliance on it. Unauthorised use, > copying or disclosure of any of it may be unlawful. If you have received this > message in error, please notify us immediately by telephone or email. > > Flexipol Packaging Ltd. has taken every reasonable precaution to minimise the > risk of virus transmission through email and therefore any files sent via > e-mail will have been checked for known viruses. However, you are advised to > run your own virus check before opening any > attachments received as Flexipol Packaging Ltd will not in any event accept > any liability whatsoever once an e-mail and/or any attachment is received. > > It is the responsibility of the recipient to ensure that they have adequate > virus protection. > > Flexipol Packaging Ltd. > Unit 14 Bentwood Road > Carrs > Industrial Estate > Haslingden > Rossendale > Lancashire > BB4 5HH > > Tel:01706-222792 > Fax: 01706-224683 > www.Flexipol.co.uk > --------------------------------------------------------------- > > Terms & Conditions: > > Notwithstanding delivery and the passing of risk in the goods, the property > in the goods shall not pass to the buyer until the seller > Flexipol Packaging Ltd. ("The Company") has received in cash or cleared funds > payment in full of the price of the goods and all other goods agreed to be > sold by the seller to the buyer for which payment is then due. Until such > time as the property in the goods passes to the buyer, the buyer shall hold > the goods as the seller's fiduciary agent and bailee and keep the goods > separate from those of the buyer and third parties and properly stored > protected and insured and identified as the seller's property but shall be > entitled to resell or use the goods in the ordinary course of its business. > Until such time as the property in the goods passes to the buyer the seller > shall be entitled at any time > > -----Original Message----- > From: ProFox <[email protected]> On Behalf Of Paul H. Tarver > Sent: 12 April 2018 14:19 > To: [email protected] > Subject: RE: Appending from a Cursor > > Ok, so let me ask the $64,000 question: Which method is faster or better: > Append From DBF( or Insert Into as Gene used? > > I have a similar project were I am issuing the same query to multiple SQL > databases/servers and then using the Append From DBF( command to aggregate > the results from each individual query into a large, single cursor to use for > actual processing. > > I'm traveling today or I'd test this myself, but I have limited access. > Figured I'd see if anyone else had already determined the best choice before > I go poking around on my own. > > Paul > > -----Original Message----- > From: ProfoxTech [mailto:[email protected]] On Behalf Of Ted Roche > Sent: Thursday, April 12, 2018 6:18 AM > To: [email protected] > Subject: Re: Appending from a Cursor > >> On Wed, Apr 11, 2018 at 8:31 PM, Gene Wirchenko <[email protected]> wrote: >> >> I am puzzled why (alimport) works for the SQL but not the append > from, >> but whatever. >> > > I agree with you that it is un-intuitive that aliases work *almost* > everywhere. It's one of those hundreds of FoxPro's "always been that way" > things. > > As others have said, APPEND FROM is ancient nearly-original XBase. > While it was updated occasionally for new file formats, the main purpose of > the command is a low-level IMPORT (sibling command) from foreign formats and > not as a cursor-manipulation command, so it's intended for reading > files-on-disk and not cursors. > > > -- > Ted Roche > Ted Roche & Associates, LLC > http://www.tedroche.com > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

