D
D
Denis Bukreev2016-01-05 03:46:27
Database
Denis Bukreev, 2016-01-05 03:46:27

What is the easiest way to store information?

For example, in the database there is a table with users
Each user has some kind of data that is not limited in number (they can occupy two rows in the table, they can be a hundred rows, or they can be a thousand)
How easy is it to store this data - in one big table or in a set of small ones, each of which will be assigned to a separate user?
In which case the query will run faster?
And which case would be more ethical, in terms of programming?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Egor Stakhovsky, 2016-01-05
@ySky

Many small tables for each user?
The easiest (and ugliest) way is to define the required minimum for each user, highlight this minimum in the table fields, and store the rest in a large text field with notes (this method remained deep in the 90s).
The second way is to make a separate table in which the data will be presented as userID, key, value, where key will encode the value of some property. This method is more elegant, but it will hit the execution speed, yes.
There is also an option with serialization of the necessary data into an array of the form key: value - and the data can be stored together with users.
But this is all about relational databases. In general, NoSQL databases have long become synonymous with a "floating" structure. Specific DBMS and general mechanisms are described in many articles .

M
Melkij, 2016-01-05
@melkij

In one partitioned table.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question