← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

Database Normalisation

database Intermediate
debt(d7/e7/b7/t5)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). While mysql-workbench, pgadmin, and db-schema-linter are listed as tools, detection_hints.automated is 'no' — identifying normalisation violations like comma-separated values, partial dependencies, or transitive dependencies requires manual schema review or runtime observation of data anomalies. No automated tool reliably catches these patterns across all cases.

e7 Effort Remediation debt — work required to fix once spotted

Closest to 'cross-cutting refactor across the codebase' (e7). Fixing normalisation issues requires restructuring database tables, creating new tables with foreign keys, migrating existing data, and updating all application queries that touch affected tables. The quick_fix describes conceptual steps (eliminate repeating groups, remove partial/transitive dependencies), but implementing these changes spans multiple files and often requires coordinated deployment with data migrations.

b7 Burden Structural debt — long-term weight of choosing wrong

Closest to 'strong gravitational pull' (b7). Database schema design shapes every query, every ORM mapping, and every data access pattern in the application. Applies_to indicates web and cli contexts — essentially all data-touching code. A normalisation decision made early becomes load-bearing; changing it later requires reworking models, queries, and potentially business logic across the codebase.

t5 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'notable trap' (t5). The misconception explicitly states 'Higher normal forms are always better' — a documented gotcha that most devs eventually learn. Experienced developers know to normalise OLTP tables but denormalise for reporting. The common_mistakes list confirms this: over-normalising analytics tables and conflating normalisation with performance are well-known pitfalls, but they're learnable rather than deeply counterintuitive.

About DEBT scoring →

Also Known As

1NF 2NF 3NF BCNF normal forms

TL;DR

The process of structuring a relational database to reduce redundancy and improve integrity, defined through progressive normal forms (1NF through BCNF).

Explanation

Normalisation eliminates update anomalies caused by duplicated data. First Normal Form (1NF): atomic values, no repeating groups. Second Normal Form (2NF): no partial dependencies on composite keys. Third Normal Form (3NF): no transitive dependencies. Boyce-Codd Normal Form (BCNF): every determinant is a candidate key. In practice, 3NF satisfies most applications. Denormalisation — intentional violation for read performance — is acceptable when backed by measured need.

Common Misconception

Higher normal forms are always better — denormalisation is often the right call for read-heavy reporting tables where join overhead outweighs storage savings.

Why It Matters

Unnormalised tables cause update anomalies — change a customer's address in one order row and it silently differs from other rows, producing inconsistent data with no error.

Common Mistakes

  • Storing comma-separated values in a single column — violates 1NF and makes querying impossible without string parsing.
  • Repeating customer name and address in every order row instead of a foreign key to a customers table.
  • Normalising reporting/analytics tables that need fast aggregations — calculated columns or materialised views are better there.
  • Conflating normalisation with performance — always normalise first, then denormalise specific tables with measurement.

Code Examples

✗ Vulnerable
-- Unnormalised: customer data repeated in every order row
CREATE TABLE orders (
    id INT PRIMARY KEY,
    customer_name VARCHAR(100),  -- Repeated for every order
    customer_email VARCHAR(100), -- Update in one row, others stale
    customer_address TEXT,
    product VARCHAR(100),
    quantity INT
);
✓ Fixed
-- 3NF: customer data stored once, referenced by FK
CREATE TABLE customers (
    id INT PRIMARY KEY,
    name VARCHAR(100),
    email VARCHAR(100) UNIQUE,
    address TEXT
);
CREATE TABLE orders (
    id INT PRIMARY KEY,
    customer_id INT REFERENCES customers(id),
    product_id INT REFERENCES products(id),
    quantity INT
);

Added 15 Mar 2026
Edited 22 Mar 2026
Views 31
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
1 ping F 0 pings S 0 pings S 0 pings M 1 ping T 0 pings W 0 pings T 1 ping F 0 pings S 0 pings S 0 pings M 0 pings T 1 ping W 0 pings T 1 ping F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 2 pings F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W 0 pings T 2 pings F 0 pings S
No pings yet today
Perplexity 1 Amazonbot 1
Perplexity 7 Amazonbot 7 Google 5 Unknown AI 2 Ahrefs 2 Bing 1
crawler 23 crawler_json 1
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: High
⚡ Quick Fix
Aim for 3NF in OLTP databases: eliminate repeating groups (1NF), remove partial dependencies on composite keys (2NF), and remove transitive dependencies (3NF) — denormalise only when query performance requires it
📦 Applies To
any web cli
🔗 Prerequisites
🔍 Detection Hints
Comma-separated values in a single column (1NF violation); columns dependent only on part of composite key (2NF); non-key column depending on another non-key column (3NF)
Auto-detectable: ✗ No mysql-workbench pgadmin db-schema-linter
⚠ Related Problems
🤖 AI Agent
Confidence: Medium False Positives: Medium ✗ Manual fix Fix: High Context: File Tests: Update

✓ schema.org compliant