The pipe is divided between separate rows

I use MySQL as a database for a Laravel application. Consider the table structure of the following <

id brand_id numbers

Given that for each brand_id there are about 5 thousand numbers. I am not sure about the following approaches.

  • Save all 5k numbers in a separate recording channel.
  • Save each of the 5k numbers as a separate entry

Incredible which approach will lead to better performance

+5
source share
1 answer

Knowing nothing about Laravel, but something about databases, my general answer would be that you will almost never store more than one item in one record in a relational database - this violates the relational model and makes the data very difficult for works, so the second approach is definitely better. Perhaps you should read about how relational databases work and about database normalization .

If you allow records to contain more than one separate element, you cannot maintain relationships between tables and not use indexing to improve performance, and you also lose many other important properties.

+5
source

Source: https://habr.com/ru/post/1240667/


All Articles