<div dir="ltr"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,51,51)"><div class="gmail_default" style="font-size:14.6666669845581px;display:inline"></div><span style="color:rgb(31,73,125);font-family:Calibri,sans-serif;font-size:14.6666669845581px">thanks for your suggestions. The data.table can’t be transformed in a matrix as it is of mixed types : POSIX.ct columns, character, logical, factor and numeric columns.</span></div></blockquote><font color="#1f497d" face="Calibri, sans-serif"><span style="font-size:14.6666669845581px"><div><font color="#1f497d" face="Calibri, sans-serif"><span style="font-size:14.6666669845581px"><br></span></font></div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,51,51);display:inline">What about casting all as character ? CSV does not make difference between types as quote is disabled in the config I proposed.</div></span></font><div><font color="#1f497d" face="Calibri, sans-serif"><span style="font-size:14.6666669845581px"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,51,51);display:inline"><br></div></span></font></div><div><font color="#1f497d" face="Calibri, sans-serif"><span style="font-size:14.6666669845581px"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,51,51);display:inline">About postgresql, I use it, and the faster way to load data is to use the COPY statement. I load 7GB of data in 5 min, but...</div></span></font></div><div><font color="#1f497d" face="Calibri, sans-serif"><span style="font-size:14.6666669845581px"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,51,51);display:inline">COPY uses a csv as source. A "binary" file can be used too, but I have never tried.</div></span></font></div><div><br></div><div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,51,51)">The package RSqlite could help too, Some use this instead of CSV writing. Never tried too.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,51,51)"></div><br></div><div><font color="#1f497d" face="Calibri, sans-serif"><span style="font-size:14.6666669845581px"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,51,51);display:inline"><br></div></span></font></div><div><font color="#1f497d" face="Calibri, sans-serif"><span style="font-size:14.6666669845581px"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,51,51);display:inline"> </div><br></span></font><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,51,51)"></div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-24 13:03 GMT+01:00 Gerald Jean <span dir="ltr"><<a href="mailto:gerald.jean@dgag.ca" target="_blank">gerald.jean@dgag.ca</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div lang="FR-CA" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Hello Nicolas,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u></span></p><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,51,51);display:inline"></div> <u></u><p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"></span></p><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,51,51);display:inline"></div>thanks for your suggestions. The data.table can’t be transformed in a matrix as it is of mixed types : POSIX.ct columns, character, logical, factor
and numeric columns.<u></u><u></u><p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Admin is currently installing PostgreSQL on the server, I’ll try to go that route. Too bad data.table doesn’t have, yet, a writing routine as
fast as “fread” is for reading!!!<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks,<u></u><u></u></span></p><span>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Gérald<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<table border="0" cellpadding="0" width="640" style="width:480pt">
<tbody>
<tr>
<td style="padding:0.75pt">
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><img width="136" height="54" src="cid:image001.gif@01D06608.FEC7C1A0"></span><span style="font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
</td>
<td style="padding:0.75pt"></td>
<td style="padding:0.75pt"></td>
</tr>
<tr>
<td width="300" valign="top" style="width:225pt;padding:0.75pt">
<p class="MsoNormal"><b><span style="font-size:8pt;font-family:Verdana,sans-serif;color:black">Gerald Jean, M. Sc. en statistiques</span></b><span style="font-size:8pt;font-family:Verdana,sans-serif;color:black"><br>
Conseiller senior en statistiques<br>
<br>
Actuariat corporatif,<br>
Modélisation et Recherche<br>
Assurance de dommages<br>
Mouvement Desjardins</span><span style="font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
</td>
<td width="170" valign="top" style="width:127.5pt;padding:0.75pt">
<p class="MsoNormal"><span style="font-size:8pt;font-family:Verdana,sans-serif;color:black"><br>
Lévis (siège social)<br>
<br>
<a href="tel:418%20835-4900" value="+14188354900" target="_blank">418 835-4900</a>,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:8pt;font-family:Verdana,sans-serif;color:black">poste 5527639<br>
<a href="tel:1%20877%20835-4900" value="+18778354900" target="_blank">1 877 835-4900</a>, <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:8pt;font-family:Verdana,sans-serif;color:black">poste 5527639<br>
Télécopieur : <a href="tel:418%20835-6657" value="+14188356657" target="_blank">418 835-6657</a></span><span style="font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
</td>
<td width="170" valign="top" style="width:127.5pt;padding:0.75pt">
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:8pt;font-family:Verdana,sans-serif;color:black"><br>
<br>
<br>
<br>
</span><span style="font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<table border="0" cellpadding="0" width="640" style="width:480pt">
<tbody>
<tr>
<td style="padding:0.75pt">
<p class="MsoNormal"><span style="font-size:7pt;font-family:Verdana,sans-serif;color:black">Faites bonne impression et imprimez seulement au besoin!<br>
<br>
</span><span style="font-size:7pt;font-family:Verdana,sans-serif;color:rgb(105,105,105)">Ce courriel est confidentiel, peut être protégé par le secret professionnel et est adressé exclusivement au destinataire. Il est strictement interdit à toute autre personne
de diffuser, distribuer ou reproduire ce message. Si vous l'avez reçu par erreur, veuillez immédiatement le détruire et aviser l'expéditeur. Merci.</span><span style="font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
</span><p class="MsoNormal"><b><span lang="FR" style="font-size:10pt;font-family:Tahoma,sans-serif">De :</span></b><span lang="FR" style="font-size:10pt;font-family:Tahoma,sans-serif"> Nicolas Paris [mailto:<a href="mailto:niparisco@gmail.com" target="_blank">niparisco@gmail.com</a>]
<br>
<b>Envoyé :</b> 23 mars 2015 17:51<br>
<b>À :</b> Gerald Jean<br>
<b>Cc :</b> <a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">datatable-help@lists.r-forge.r-project.org</a><br>
<b>Objet :</b> Re: [datatable-help] Best way to export Huge data sets.<u></u><u></u></span></p><div><div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif;color:rgb(0,51,51)">Some test you can do without many code change :<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif;color:rgb(0,51,51)">1) transform your data.table as matrix before write<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif;color:rgb(0,51,51)">2) use write table + this config to save place& time<u></u><u></u></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif;color:rgb(0,51,51)">->sep = Pipe (1byte& rarely used)<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif;color:rgb(0,51,51)">->disable quote (saves "" more than bilion times)<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif;color:rgb(0,51,51)">->latin1 instead of utf-8<u></u><u></u></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif;color:rgb(0,51,51)">3) use chunks (say cut in slice output) and append=T (this may work in parallel)<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif;color:rgb(0,51,51)"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif;color:rgb(0,51,51)">If still too long, try installing some database (sqlite) on your 24 core system, and try load it<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif;color:rgb(0,51,51)"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif;color:rgb(0,51,51)">hope this helps<u></u><u></u></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">2015-03-23 14:49 GMT+01:00 Gerald Jean <<a href="mailto:gerald.jean@dgag.ca" target="_blank">gerald.jean@dgag.ca</a>>:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Hello,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">I am currently on a project where I have to read, process, aggregate 10 to 12 millions of files for roughly 10 billions lines of data.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">The files are arranged in roughly 64000 directories, each directory is one client’s data.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">I have written code importing and “massaging” the data per directory. The code is data.table driven. I am running this on a 24 cores machine with 145 Gb of
RAM on a Linux box under RedHat.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">For testing purpose I have parallelized the code, using the doMC package, runs fine and it seems to be fast. But I haven’t tried to output the resulting files,
three per client. A small one, a moderate size one and a large one, over 500Gb estimated.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">My question:</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">what is the best way to output those files without creating bottlenecks??</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">I thought of breaking the list of input directories into 24 threads, supplying a list of lists to “foreach” where one of the components of each sub-list would
be the name of the output files but I am worried that “write.table” would take for ever to write this data to disk, one solution would be to use “save” and keep the output data in Rdata format, but that complicates further analysis by other software.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">Any suggestions???</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">By the way “data.table” sure helped so far in processing that data, thanks to the developpers for such an efficient package,</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">Gérald</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<table border="0" cellpadding="0" width="640" style="width:480pt">
<tbody>
<tr>
<td style="padding:0.75pt">
<p class="MsoNormal"><img border="0" width="136" height="54" src="cid:image001.gif@01D06608.FEC7C1A0"><u></u><u></u></p>
</td>
<td style="padding:0.75pt"></td>
<td style="padding:0.75pt"></td>
</tr>
<tr>
<td width="300" valign="top" style="width:225pt;padding:0.75pt">
<p class="MsoNormal"><b><span style="font-size:8pt;font-family:Verdana,sans-serif;color:black">Gerald Jean, M. Sc. en statistiques</span></b><span style="font-size:8pt;font-family:Verdana,sans-serif;color:black"><br>
Conseiller senior en statistiques<br>
<br>
Actuariat corporatif,<br>
Modélisation et Recherche<br>
Assurance de dommages<br>
Mouvement Desjardins</span><u></u><u></u></p>
</td>
<td width="170" valign="top" style="width:127.5pt;padding:0.75pt">
<p class="MsoNormal"><span style="font-size:8pt;font-family:Verdana,sans-serif;color:black"><br>
Lévis (siège social)<br>
<br>
<a href="tel:418%20835-4900" target="_blank">418 835-4900</a>,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8pt;font-family:Verdana,sans-serif;color:black">poste 5527639<br>
<a href="tel:1%20877%20835-4900" target="_blank">1 877 835-4900</a>, </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8pt;font-family:Verdana,sans-serif;color:black">poste 5527639<br>
Télécopieur : <a href="tel:418%20835-6657" target="_blank">418 835-6657</a></span><u></u><u></u></p>
</td>
<td width="170" valign="top" style="width:127.5pt;padding:0.75pt">
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:8pt;font-family:Verdana,sans-serif;color:black"><br>
<br>
<br>
</span><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"> <u></u><u></u></p>
<table border="0" cellpadding="0" width="640" style="width:480pt">
<tbody>
<tr>
<td style="padding:0.75pt">
<p class="MsoNormal"><span style="font-size:7pt;font-family:Verdana,sans-serif;color:black">Faites bonne impression et imprimez seulement au besoin!<br>
<br>
</span><span style="font-size:7pt;font-family:Verdana,sans-serif;color:rgb(105,105,105)">Ce courriel est confidentiel, peut être protégé par le secret professionnel et est adressé exclusivement au destinataire. Il est strictement interdit à toute autre personne
de diffuser, distribuer ou reproduire ce message. Si vous l'avez reçu par erreur, veuillez immédiatement le détruire et aviser l'expéditeur. Merci.</span><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><br>
_______________________________________________<br>
datatable-help mailing list<br>
<a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">datatable-help@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>
</blockquote></div><br></div></div></div>