I know that the main problem of files is the discovery of everything at once, and tearing out the necessary one, because of which the speed is lost, because the download volume is large.

What will happen if you store each material in a separate file and get data from the algorithms? Theoretically, would it be faster than a database?

    4 answers 4

    the main problem of the files is the discovery of everything at once, and tearing out the necessary one, because of which the speed is lost, because the download volume is large.

    No, not this :) It is not necessary to store everything inside the files that "emulate" the database. You can store there, for example, identifiers of files with content, and remove the data from them as needed.

    But the relatively complex logic of work is already a problem. Without a database, you can get stuck with some kind of sampling on a difficult condition, but with joins, on groups, which in SQL is done with one left ...

    As a curious example, you can look at, for example, the GetSimple CMS . Everything is organized in the form of XML-repositories, Nitsche, lives and even works :)

      It all depends on how you work with the data.

      Suppose that the data are heavy images (bmp, tiff, etc.), each image is characterized by a unique name (xxx.xxx). Suppose that the image is always accessed by this name. Does this case need any special database?

      The SQL database is not needed because the query language is not needed; NoSQL-base may be needed, and maybe not needed: in fact, accessing a file by name in a suitable file system (xfs) is fast enough, the operating system itself can cache frequently retrieved files in memory.

      The need for a database arises when there is a need for something beyond the minimum that the file system gives.

      • Here the obvious suggests itself: FS can be more effective in at least 2 cases. When working with key / value pairs and when working with graphs / trees ... - user6550

      There is a so-called SQLite DB, it stores the database in a separate file, the name makes it clear that it supports the SQL language. Working with it is quite easy, in every programming language there are drivers for working with it, unlike other SQL databases, it does not require a separate daemon.

      • I did not ask to recommend a database that stores everything in one file. - andrewshka
      • Yes, and did not ask for anything to recommend. - andrewshka

      Yeah files, I want to get all the students graduated from school in '96, with a troika in geography and remaining for the second year. I have a folder in which 1500 files lie. Each file = one school record. You now propose to write your own parser / regexp, and not to write a two-line Select, which will trigger the search algorithm already written on the server, which for 30 years has been optimized by a huge crowd of programmers around the world.

      • 3
        Is it not obvious that tasks are different? And that storage / tools need to be designed in advance ... - user6550
      • Therefore, they write a different request each time. And to pre-design the repository there is another request CREATE TABLE and ADD. This is more convenient than writing a regular code for each task. - igumnov
      • And what does all this have to do with the issue under discussion? If you have not seen effective work with well-organized repositories in files, this does not mean that it cannot be at all, and that the database is a universal plug to everything in the world. - user6550 September
      • Thank you, the only answer on the topic. - andrewshka