I
I
Ivan2015-11-19 05:14:13
PHP
Ivan, 2015-11-19 05:14:13

What is faster to use to get data into an array - files or a database?

I have several rather big lists of words which now lie in 6 text files. For the script to work, it gets each of them into a separate array with the File function, then merges the resulting arrays into one large array with the array merge function.
What do you think if you create a table in the database for each list - will the data in the array from the database be obtained faster or not?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ravshan Abdulaev, 2015-11-19
@iwqn

if it's good, then for a correct assessment it is necessary to write out the criteria for evaluating "quickness". each approach has pros and cons. Surely "speed" is not the main problem when designing.
As far as I remember, in popular free cms (wordpress drupal joomla), the issue of language localization is solved through the file system and works approximately as described in your example. At the same time, it is not a fact that "speed" was the main criterion for such a decision. Perhaps the transparency or predictability of the file structure, updates or other issues were more important.
In your example, one of the advantages of storing in a database is the ability to get data in one request, perhaps this will shorten your code, this is for applicability for filling array data, but again, keep in mind that each approach has both pros and cons.

L
link_irk, 2015-11-19
@link_irk

If the data has a certain structure, links, then it is advisable to use a database. If it's just strings (which do not need to be processed), then you can get by with files. Thus, the speed of working with this data at the file or database level depends on the data itself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question