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

InnoDB vs MyISAM

Database Beginner
debt(d5/e3/b5/t7)
d5 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'specialist tool catches it' (d5). The detection_hints list semgrep as the tool, with a code_pattern of ENGINE=MyISAM in CREATE TABLE or SHOW TABLE STATUS. Semgrep is a specialist static analysis tool that requires deliberate configuration, not a default linter or compiler error, placing this squarely at d5.

e3 Effort Remediation debt — work required to fix once spotted

Closest to 'simple parameterised fix' (e3). The quick_fix is to specify ENGINE=InnoDB in CREATE TABLE or set innodb as default_storage_engine in config. Migrating existing tables requires running ALTER TABLE ... ENGINE=InnoDB per table, which is a small repeatable pattern across potentially multiple tables but not a deep architectural refactor — closest to e3, nudged to e3 as the fix is straightforward even if applied to multiple tables.

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

Closest to 'persistent productivity tax' (b5). MyISAM's lack of transactions and table-level locking affects any concurrent write workload and any code that relies on foreign keys or transactional integrity. The burden applies broadly across web and CLI contexts (per applies_to), meaning many future features touching the DB are shaped by this choice, though it doesn't fully define the system's architecture.

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

Closest to 'serious trap' (t7). The misconception field explicitly states that developers believe MyISAM is faster, when InnoDB is actually faster for typical concurrent OLTP workloads. Additionally, MyISAM silently ignores FK constraints (noted in common_mistakes), meaning behaviour contradicts what a developer familiar with relational databases would expect — a silent, dangerous divergence from standard relational semantics that contradicts how foreign keys work elsewhere.

About DEBT scoring →

Also Known As

InnoDB MyISAM MySQL storage engine InnoDB vs MyISAM

TL;DR

InnoDB is the default MySQL storage engine supporting transactions, foreign keys, and row-level locking — MyISAM is legacy with table-level locking and no transaction support.

Explanation

InnoDB has been MySQL's default since 5.5. It supports ACID transactions, row-level locking (better concurrency), foreign key constraints, crash recovery, and MVCC. MyISAM offers faster full-table reads and has slightly smaller on-disk storage but lacks transactions, crashes inconsistently, and uses table-level locking that serialises all writes. New tables should always use InnoDB. MyISAM FULLTEXT search support has been superseded by InnoDB FULLTEXT (available since MySQL 5.6).

Common Misconception

MyISAM is faster than InnoDB. For typical OLTP workloads with concurrent reads and writes, InnoDB is faster due to row-level locking. MyISAM's speed advantage was real in MySQL 4.x era.

Why It Matters

Using MyISAM means no transactions — data corruption from partial writes is possible on server crash. Row-level locking in InnoDB allows many concurrent writers; MyISAM's table lock makes a single write block all other writes.

Common Mistakes

  • Creating tables without ENGINE=InnoDB on older MySQL installations that default to MyISAM.
  • Using MyISAM tables in a schema that relies on foreign keys — MyISAM silently ignores FK constraints.
  • Not converting existing MyISAM tables when adding transactions to an application.

Avoid When

  • Never use MyISAM for tables that participate in transactions or have foreign key constraints.
  • Do not use MyISAM for any table that receives concurrent writes — table-level locking serialises all writes.

When To Use

  • Always use InnoDB — it is the default and correct choice for all new tables.
  • Migrate existing MyISAM tables to InnoDB with ALTER TABLE ... ENGINE=InnoDB.

Code Examples

✗ Vulnerable
-- MyISAM: no transactions, no FK, table-level lock
CREATE TABLE orders (...) ENGINE=MyISAM;
✓ Fixed
-- Always explicit ENGINE=InnoDB
CREATE TABLE orders (
    id         INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    user_id    INT UNSIGNED NOT NULL,
    total      DECIMAL(10,2) NOT NULL,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (user_id) REFERENCES users(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Added 31 Mar 2026
Views 49
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 1 ping T 0 pings W 0 pings T 1 ping F 1 ping S 2 pings S 1 ping M 1 ping T 0 pings W 3 pings T 0 pings F 1 ping S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 1 ping S 1 ping S 0 pings M 0 pings T 0 pings W
No pings yet today
No pings yesterday
Google 8 Scrapy 7 SEMrush 5 ChatGPT 4 Ahrefs 3 Unknown AI 2 Meta AI 2 Perplexity 1 Claude 1 Bing 1 Majestic 1 PetalBot 1
crawler 33 crawler_json 3
DEV INTEL Tools & Severity
⚙ Fix effort: Low
⚡ Quick Fix
Always specify ENGINE=InnoDB in CREATE TABLE — or set innodb as the default_storage_engine in MySQL config
📦 Applies To
web cli
🔗 Prerequisites
🔍 Detection Hints
ENGINE=MyISAM in CREATE TABLE or SHOW TABLE STATUS
Auto-detectable: ✓ Yes semgrep
⚠ Related Problems
🤖 AI Agent
Confidence: High False Positives: Low ✓ Auto-fixable Fix: Low Context: Line


✓ schema.org compliant