storing text: files or rdbms?
I need to store some amount of text data (~10-500K). Just store, no op开发者_Python百科erations like sorting or search are required, modifications are rare - all I want just to access information by some key (and this is quite often).
What is more suitable for that purpose: files or RDBMS and why?If you want to access data by some key, an RDBMS would be the logical option. It is often the case that data grows with age and changes to the point of requiring different types of search.
Often times data is dumped into text files, but the location of said files or the format of said data gets forgotten. A database helps with this by centralizing the (location of the) data and via a schema definition that helps define the format and content of the data. As an added bonus, you get built in query functionality to help with searching and the fact that if the DB is managed properly it becomes stable storage that can survive anything from hard drive failures to entire site failures.
You have no web related tags, so assuming this is for local access and you have rights to reading/writing to these files and security is no issue, then file should be fine. No need to deal with another layer (RDBMS).
Files are also easy to pick up and move to another machine, without having to install an RDBMS again or set up a network access to a DB Server.
However, if you might need search in the future, or each text data might have other information linked to it without being a part of the actual data (ie. other columns in a table) then it might be easier for you to start with RDBMS.
精彩评论