AccueilGlossaire › Hash Index

Hash Index

Data

Index basé sur fonction de hash, ultra-rapide pour equality lookups uniquement.

Hash Index est une structure d'index basée sur fonction de hash mappant key → bucket location. Ultra-rapide pour equality lookups O(1) mais ne supporte PAS range queries, ORDER BY, ni partial matches.

Utilisation principale :
- **PostgreSQL** : `CREATE INDEX ... USING HASH (col)` — utilisable mais moins performant que B-Tree dans la plupart des cas (B-Tree presque aussi rapide pour equality, supporte plus).
- **MySQL InnoDB** : Adaptive Hash Index (AHI) — auto-built internally pour hot data, pas exposed à user.
- **MySQL MEMORY engine** : HASH indexes par défaut.
- **Redis** : entirely hash-based (keys → values).
- **DynamoDB** : partition key = hash, équivalent fonctionnel.
- **Hash partitioning** des tables — distribute rows across partitions via hash.

Quand préférer Hash sur B-Tree :
(1) **Très large indexes** avec only equality queries — hash potentially smaller.
(2) **In-memory tables** ;
(3) **Specific use cases** où optimization micro justifiée.

Limitations critiques :
(1) **No range queries** — `WHERE id > 100` impossible avec hash.
(2) **No ORDER BY** support.
(3) **No partial keys** in composite hash.
(4) **Collisions** dégradent performance (bucket overflow).
(5) **No prefix matching** (LIKE 'foo%').

In practice B-Tree dominate. Hash indexes rarement utilisés explicitement en RDBMS. Plus relevant dans NoSQL designs (key-value, columnar) et internal DB structures (hash join, hash aggregate temporary). Compétences DP-300.

Certifications qui couvrent ce concept
DP-300 DEA-C01
Termes liés
B-Tree Index Full-Text Index NoSQL

Préparez vos certifications IT gratuitement

200+ certifications, 400 000+ questions, examens blancs chronométrés.

Voir le catalogue →
← Retour au glossaire