M
M
Maxim Khodyrev2014-05-30 11:46:04
MySQL
Maxim Khodyrev, 2014-05-30 11:46:04

What is more correct and faster: duplicate identical columns in several related tables or use JOINs?

Essence of the question:
There are several types of services, each of them contains fields such as activation date, end date, etc., and at the same time has specific options that will be selected.
What is more correct and faster in this case?

  1. Create a parent table (with common fields) and link the parameter tables of each specific service to it
  2. Cram everything into one table and use VIEW for each specific type of service
  3. Create different tables for all service types and duplicate common fields

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Solovyov, 2014-05-30
@maximkou

1 option

T
tovogukA, 2016-03-14
@tovogukA

With JOIN - formally more correct for any RDBMS. Performance is usually good enough.
But in some RARE cases it can cause performance issues.
Option with one table (with duplicates) - in such RARE cases it helps to solve the performance problem. But jambs are possible - due to the lack of synchronization of duplicate information.
But, as a rule, the problem with performance lies in another plane.
Duplicate, in practice, has to be for a different reason - NOT AT ALL because of performance.
For example, an online store:
Prices - may change.
But in the table with the goods already ordered, everything should go (duplicate) as before, that is, the price that was at the time of placing the order by the buyer. And not at all a link to a table with current prices.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question