Duplicate Critical Fields
What you'll learn: How storing frequently-accessed data redundantly across tables eliminates expensive joins and speeds up common queries.
The Core Idea
Duplicate Critical Fields means intentionally copying certain data across multiple tables so you can retrieve everything you need without performing joins. While this violates normalization principles, it's a practical denormalization technique that dramatically improves query performance for read-heavy workloads.
Instead of joining three tables to display basic information, you store critical fields directly where they're needed most.
Why This Matters
Joins are expensive, especially at scale. Every join requires the database to match rows across tables, which consumes CPU and I/O. When displaying a user's feed with thousands of posts, joining the users table to fetch each author's name becomes a major bottleneck.
By duplicating the author_name field directly in the posts table, you eliminate that join entirely for the most common read operation.
The Trade-Off
Benefits:
- Faster queries (no join overhead)
- Simpler query logic
- Reduced load on heavily-joined tables
Costs:
- Extra storage space (usually negligible)
- Data consistency challenges (must update multiple places)
- More complex write operations
When to Duplicate
Duplicate fields that are:
- Read extremely frequently
- Rarely updated (like usernames or product names)
- Small in size
- Critical for common query paths
Example: Storing product_name in orders table even though it exists in products table. Orders are queried constantly, but product names rarely change.
Key Takeaway: Duplicate critical, frequently-read fields across tables to eliminate expensive joins, accepting the trade-off of managing consistency across multiple copies of the same data.