S
S
Sergey Ivanov2014-08-18 11:22:23
PHP
Sergey Ivanov, 2014-08-18 11:22:23

Who will tell the disadvantages of this database structure, except for the atomicity of the data?

I experimented with the database and realized that keeping a JSON string right away is easier than building it before outputting it to the browser.
To comparison, 2 tests were made.
500 users answered 20 questions and saved their results in a database.
In a table with atomic values, we got 10,000 rows and a query about 0.5 seconds per hot.
| id_user | num_vopros | num_otvet | time |
The same was done with a table where all the responses were in a JSON string. Each user had his own with answers.
| id_user | json_str |
The request was about 0.0010 sec.
Further, giving the user a JSON string is faster than generating it from the database via php.
PS The data is finite and there are no tables that depend on this data.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Nikitin, 2014-08-18
@Writerim

And what for to you in general then the SQL server? Try a NoSQL database... or even an elasticsearsh index for example. ;-)

A
AxisPod, 2014-08-18
@AxisPod

You should go to a fortuneteller, she will definitely give you the answer. And you should start by learning how to ask questions.
The structure of the table implies not only the names of the fields, but also information about the field (type, flags), indexes, etc.
The request, as it were, implies the presence of the request itself, and not a spherical horse in a vacuum.
And in such a formulation, an adequate answer cannot be given at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question