Hello! What is faster or optimized, use:

  1. A table that contains about 30 fields, with mostly data (0,1) or a small number;
  2. Use a table that contains 2 fields, but the second field contains data for all 29 fields separated by a sign (|). And then through explode output them as an array.

I ask you to say only how it will be better from the point of view of productivity, as far as convenience is, writing it to me as it is, so convenient in principle. Thank!

  • IMHO if only 30 records - then you should not think about speed. Unless this array will be run 100,000 times through the cycle - alexeich

1 answer 1

I think that it will be more productive if it is in the file, because in any case you have to make a query to the database, but if only from these two options, then in principle 1 is better. But this is such a miser that you should not even think about it ...

  • I also thought about the file, but it seems to be in terms of processing speed, the file will lose in time in this case. Mizer, mizzer, but the load will give other scripts on the site, so as they say "Kopeyka - the ruble saves." - Node_pro
  • If you process some information, the file should not lose the database. - Jeremen1
  • 2
    The file is of course, why the database for such elementary purposes. DB was invented to handle a large number of complex data. Connecting to the database, sampling, sorting, outputting results, queries, queries, queries, why? Entirely read the file into an array and work with it! Definitely faster! - Gene Ant