Buffered input for big numeric input files
Buffered input for big numeric input files
От:
Guillaume Marçais <gus@nist.gov>
Дата:
I want to fill database from columns in a numeric table in a file. I want to place the values from each column into a separate array in the database. I know that I can read each row in the file a fill in the arrays one value at a time, and after reading the entire file, write each array out to the database from memory (with an INSERT INTO statement). However, I'd like not to have to have all of the arrays in memory. So, I'd like to write the values into the database as they are read. Is there are way to create a set of fixed-length arrays and as they are filled periodically update the database and flush them -- in effect buffering the input. This will allow me to process arbitrarily large files without having to worry about memory requirements. Thanks in advance for any suggestions. Gus.