M
M
Maxim Osadchy2017-09-17 18:38:53
MySQL
Maxim Osadchy, 2017-09-17 18:38:53

Why split a db table?

For example, there is a product table, it has id, name fields, there is a product_price table, it has id, product_id, price fields.
I often come across such a design, and subsequently, in order to get the necessary product data, I have to write 15 joins, and this seems to affect performance a little.
I’m not banned in Google, but I don’t know how to formulate the question correctly, so if there is something to read on this topic, I will be happy with links.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2017-09-17
@waspmax1

https://ru.wikipedia.org/wiki/Normal_form
Joins have not been a problem in queries for a long time if there are required indexes
The product has different prices - purchase, wholesale, retail, credit, sale to a group of registered users
Although in the case with the price - it is more logical to include everything in one table if the price matrix is ​​not sparse
Read also about EAV

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question