Search code examples
databaseprogramming-languagesinformation-retrieval

When is it a good idea to use a database


I am doing an information retrieval project in c++. What are the advantages of using a database to store terms, as opposed to storing it in a data structure such as a vector? More generally when is it a good idea to use a database rather than a data structure?


Solution

    1. (Shawn): Whenever you want to keep the data beyond the length of the instance of the program. (persistence across time)

    2. (Michael Kjörling): Whenever you want many instances of your program, either in the same computer or in many computers, like in a network or the Net, access and manipulate (share) the same data. (persistence across network space)

    3. Whenever you have very big amount of data that do not fit into memory.

    4. Whenever you have very complex data structures and you prefer to not rewrite code to manipulate them, e.g search, update them, when the db programmers have already written such code and probably much faster than the code you (or I)'ll write.