When to use a database

I am doing an information search project in C ++. What are the benefits of using a database to store terms, rather than storing it in a data structure such as a vector? More generally, when is it better to use a database rather than a data structure?

+3
source share
4 answers
  • (Shawn): whenever you want to save data beyond the length of a program instance. (constancy in time)

  • (Michael Kjörling): whenever you want many instances of your program to be on the same computer or on many computers, for example on a network or on the Web, access and use (sharing) of the same data. (storage in network space)

  • Whenever you have a very large amount of data that does not fit into memory.

  • Whenever you have very complex data structures, and you prefer not to rewrite the code to manipulate them, for example, to search for, update them when the db programmers have already written such code and probably much faster than the code you (or I will write.

+2
source

Whenever you want to save data beyond the length of a program instance?

+2
source

, : , ?

, .

+2
source

It really depends on the volume. For example, if you have several applications accessing data, then the database is better because you do not have to worry about locking files, etc. In addition, you should use the database when you need to do things like combine other data, sort, etc. if you do not want to use Quicksort.

+1
source

All Articles