Modifying a data file seems like a bad solution. A better option is to store the line number reached for each file. If there is a failure, skip to that line number, and start processing again.

I would write the filename and line number to a log file after a block of lines. 1000 lines is probably a good size. The log file becomes a nice way to measure the progress, and to record what has been done. When there is a failure, find the last line for each file in the log.

Make transactions larger is a big performance boost for bulk inserts. I would make the group for a transaction the same size as the group for writing line numbers. For each group, I would write the log entry and commit.


In reply to Re: Better way to work with large TSV files? by iburrell
in thread Better way to work with large TSV files? by radiantmatrix

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.