Hey Jim, > If your machine is on an SSD…
That makes sense to my very simple mind! <wink> I don’t think in all my years of 4D dating back to beta Silver Surfer days I have ever needed a routine where buffering using a BLOB was required. That’s amazing! Anyway... Thanks again for your advice and for the code! Makes it so much easier to think it through (see and build upon). Appreciate, John… > On Apr 15, 2020, at 3:19 PM, James Crate <[email protected]> wrote: > > On Apr 15, 2020, at 4:35 PM, John J Foster via 4D_Tech <[email protected]> > wrote: >> >> I do believe that creating it locally and moving to the network drive can be >> more efficient. I’m not sure how much speed different there would be. >> >>> using TEXT TO BLOB with the offset parameter >> >> I’m investigating this command and seeing if I can understand how to use it. > > If your machine is on an SSD, there will probably be little difference > between writing each row with SEND PACKET or buffering using a BLOB. If you > want to buffer using a blob, the general strategy is like this: > > // Calculate rough target size of blob plus a little extra. If 2.3M rows was > 830MB, you are at roughly 2700 rows per MB, so maybe calculate 1MB per 2500 > rows > $blobSize:=(number of records / 2500)*(1024*1024) > SET BLOB SIZE($buffer;$blobSize) > $offset:=0 > For ($i;1;number of records) > // build line into $line > // make sure we have enough space in the blob > If (Blob size($buffer)<($offset+Length($line)) > $blobSize:=$blobSize+(Length($line)*2000)// increase by enough that we > don’t have to do it often > SET BLOB SIZE($buffer;$blobSize) > End if > TEXT TO BLOB($line;$buffer;UTF8 text without length;$offset) > End for > // Truncate blob to correct length > SET BLOB SIZE($buffer;$offset) // blobs are zero-indexed > > > Jim Crate > ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

