Junior — Middle
Is table partitioning in a database a good practice, and what are its advantages or disadvantages?
sobes.tech AI
Answer from AI
Table normalization in a database is a good practice that helps organize data more efficiently.
Advantages:
- Reduces data redundancy, which decreases the volume of stored information.
- Eases maintenance and updates, as changes in one place are reflected correctly.
- Increases data integrity through the use of relationships between tables (e.g., foreign keys).
Disadvantages:
- Complicates queries, as retrieving complete information often requires joining multiple tables (JOIN).
- Possible performance decrease with a large number of joins.
Example: instead of storing information about orders and customers in one table, it is better to split into two — Clients and Orders, linked by client_id. This prevents duplication of customer data in each order record.