in reply to reading columns from a flat file

As far as I can see there's really no middle-ground between reading the entire file into memory, or scanning the file every time a new row is requested.

If you read the file into memory you could destroy your data structure as rows are fetched. You'll slowly recover your memory.

If you're scanning down the file you could remember the seek positions of the end of each column for each line in the file. Seeking instead of reading and discarding lines may be a bit faster, but then, the extra complexity may simply not be worth it.

I think your best bet is a heuristic; if the file is larger than some threshold, use the slow scan; if it's smaller, read it into memory.