B
B
bituke2020-09-28 07:32:49
Database
bituke, 2020-09-28 07:32:49

Why are different DBMS needed when you can use language data structures like dictionaries and lists in python?

With the help of dictionaries, lists, sets, tuples, you can completely replace the database for any task. So why bother, study various databases, subds, if you are fluent in the same python? The question may seem silly to you, but I'm really wondering why people use the database? Because of the speed?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
S
Sergey Gornostaev, 2020-09-28
@bituke

If the entire set of functions provided by the DBMS is implemented on the structures of the language, then a new DBMS will be obtained. Why waste time and effort on writing a DBMS, if there are already ready-made ones?

Z
zexer, 2020-09-28
@zexer

1. The DBMS kernel works with data in a different structure than you work with lists and all sorts of tuples.
The DBMS can process much more data and much faster than you do it in python, at least thanks to indexes (read about indexes).
2. In addition, your sets and tuples need to be stored somewhere, where? As a .txt or .json file on your computer? Don't you think that this is a little unreliable?
3. In the database, you can set many restrictions and checks, for example, for the uniqueness of the data (so that each person has their own id), for the incoming data to correspond to the required types, checks for NULL values, as you will do all this through .txt files ?
4. The database has the concept of a transaction, which, of course, your files will not give you either.
5. Data with the help of a DBMS is easy to read, since it is presented in a tabular form, it is convenient to apply filtering, sorting, and various connections between tables to each other.
6. And a dozen more different benefits, which do not even make sense to talk about.

Y
Yerlan Ibraev, 2020-09-28
@mad_nazgul

Because of ACID, well, plus SQL :-)

C
ComodoHacker, 2020-09-28
@ComodoHacker

Main reasons:

  1. There is a lot of data and it does not fit in RAM. And data accumulates over time. Therefore, if the project does not die in the first year, then over time it will come to this situation.
  2. The data is used by multiple applications at the same time. Or multiple processes of the same application
  3. Data in RAM is lost when process/OS crashes/lights out. For most applications, this is unacceptable.

S
soremix, 2020-09-28
@soremix

There are many reasons, for small projects you can even write in .txt. But on larger ones, you can no longer do without a full-fledged database. Imagine that all VKontakte users, their posts, messages, photos, music and a ton of other things are stored in one dictionary usersin python.

V
Valery Mamontov, 2020-09-28
@vmamontov

bituke , I'll bring in my "five cents".
There is a cool report from Raymond Hettinger about dictionaries. Check it out.
In his presentation, Raymond talks about dictionaries in Python and draws an analogy with databases.
<<Link to the report>>
Content of the report: 90% python, 10% humor and ... does not contain GMOs)).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question