B
B
Banny_Boom2015-08-20 12:55:32
Fonts
Banny_Boom, 2015-08-20 12:55:32

Is it worth storing the array in the database?

The user must enter certain links (about 30 links)
What is the best way to store this data?
Serialize array and write to database?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2015-08-20
@Banny_Boom

Serialize array and write to database?

postgresql has normal arrays, you can use them.
In general, the train of thought should be like this - first we think about normalization, then we denormalize for the sake of performance (there must be reasons for this).

M
mr-molodoy, 2015-08-20
@mr-molodoy

What database are you using?
If the data structure is not relational in the project, look towards mongodb.
MongoDB is a document-oriented database, the format of each document in the collection is an extended JSON specification.
Using such a solution will allow you to:
1. Not bother with data serialization / deserialization.
2. Provides a convenient way to get, for example, all records that have or do not have this or that link in the array.
3. Allows you to store the data structure of any nesting of arrays and a simple selection from it, as well as conveniently update the data in the collection.
4. Each document is not strictly tied to the structure of the collection structure, as, for example, in relational databases such as MySQL (all rows have the same data set (that is, it is not possible to store some records with the same set of fields in one table, and in the second with another)). It can be both a plus and a minus, it all depends on the specific requirements for the architecture and the directly stored data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question