New answers tagged file-systems
The most efficient way to insert a block of bytes in the middle of a file would be to: Map the file to memory Append the bytes at the end of the memory image of the file Rotate these files into place (with a standard algorithm available in the C++ Standard Library, for instance) Let the OS take care of writing dirty blocks to disk
Assuming you don't have an immediate need to query over those JSON fields, then there's nothing wrong with this approach, so long as the performance hit of deserializing/serializing isn't a problem for your program. Later on, let's say the requirement comes in to order/filter based on that "sales_rank" JSON field. You'd write a program to run over the data ...
It is sometimes a better fit for the application to store a complete document as one entity. It is not a coincidence that nosql and document databases are on the rise. If you are aware of the drawbacks it can be an ok approack but you should also consider a real document database instead of inventing your own.
Top 50 recent answers are included