4 ms·
For an append to a CSV file it shouldn't be too hard to update the index. Remove the last byte in your current format and just parse the additional lines and ap
by breck 12y ago
For an append to a CSV file it shouldn't be too hard to update the index. Remove the last byte in your current format and just parse the additional lines and append to your index.
And I'm sure there's a technique out there to handle the update case. I'm not too familiar with hard disk operations so I wouldn't know it.
If you insert a byte at position 2 in a 1GB file will the whole file get rewritten? Or are there techniques out there to store updates to a char array without having to rewrite the whole thing?
- burntsushi 12y agoI'm pretty sure you're barking up a long and complex tree. The first problem (for xsv) is that it doesn't control the csv data. So it doesn't know what changes were made. It could have even become an invalid csv file. The second problem is that insertions in sorted sequences are hard and are one of the fundamental problems in a database implementation: http://en.wikipedia.org/wiki/B-tree#The_database_problem http://en.wikipedia.org/wiki/B-tree#The_database_problem
- breck 12y agoAgreed. It's complex but a common situation so I knew there'd be a lot of well tested approaches.