Database or files?

The question was asked: 6 years 9 months ago   views: 17

I know that the main problem of the files are open all at once, and pulling is needed, which is lost speed because the download size is large.

What would happen if you were to store each material in a separate file, and algorithms to get the data? Theoretically, whether it is a faster database?

Asked: 06-09-2012 в 12:34:43

Answers   4


the main problem file is opening all at once, and plucking need, which defeats the speed because the loading capacity is large.

No, not this :) not necessarily all be stored inside the file that "emulates" the database. Store you can, for example identifiers of content files, and the data is removed from them as necessary.

But relatively complex logic is already a problem. Without a DB, you can zadolbalsya with some sample through a difficult condition, but with joyname on with the group buy, which in SQL is done with one hand...

As a curious example, we can see, for example, on GetSimple CMS. Everything is organized in the form of XML repositories, Nitsche, lives and even works :)

Answered: 06-09-2012 в 13:08:55

It all depends on the way to work with data.

Assume that the data is a rough image (bmp, tiff, etc.), each image has a unique filename ( Suppose that the appeal to the image is always by this name. Whether in this case any special database?

The SQL database is not needed because don't need a query language; NoSQL base can be necessary, and maybe not needed: in fact, reference the file name in the proper file system (xfs) quickly enough, the operating system itself can cache frequently retrieved files in memory.

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

Answered: 06-09-2012 в 12:54:25
Here begs the obvious: the FS can be effective in at least 2 cases. When working with pairs key/value and graphs/trees... -
06-09-2012 в 16:22:00

There are so-called SQLite database, it stores the database in a separate file from the name it is clear that it supports the SQL language. Working with her is easy enough, every programming language has a driver to work with it, unlike other SQL databases it doesn't require a separate daemon.

Answered: 06-09-2012 в 13:21:31
I was not asked to recommend a database that stores everything in one file. - 06-09-2012 в 16:14:24
Yes and do not ask anything to recommend. - 06-09-2012 в 16:15:01

Yeah the files that you want to get all the students graduated from high school in ' 96, three in geography and remained in the second year. Have a folder which contains 1500 files. Each file = one record of the school. You suggest writing your own parser/regexpal it, not to write a two-line Select, which will cause already written a search algorithm on the server, which is already 30 years optimize a huge crowd of programmers around the world.

Answered: 06-09-2012 в 14:16:06
Isn't it obvious that the tasks are different? And that vault/the tools you need to design in advance... - 06-09-2012 в 14:22:38
So I write each time a different query. And pre-design of the vault is another query CREATE TABLE, and ADD. It is easier than writing for each task, another code. - 06-09-2012 в 14:32:22
And what does all this have to the discussion? If you have not had to meet effective work with well-organized storage in files, it does not mean that it can not be at all, and that database is a universal bung everything in the world. -
06-09-2012 в 14:36:16
Thanks, the only answer on the topic. -
06-09-2012 в 16:18:26