IndexedDB Indexes: Fast Queries in the Browser

An IndexedDB index is like a book's index, letting you quickly find records by a specific property without scanning the entire dataset. It's essential for fast queries on non-primary keys, like looking up a user by email.
Think of an IndexedDB index like a book's index: it lets you find records by a property's value without scanning the entire object store. This is crucial for performant lookups on non-primary keys, like finding users by email or posts by tag. The `multiEntry` option even lets you index individual items within an array, perfect for tags. The main footgun: indexes can *only* be created or modified inside an `onupgradeneeded` event handler, during a database version upgrade. Attempting it elsewhere will fail.
Read the original → developer.mozilla.org
- #indexeddb
- #web apis
- #storage
- #performance
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.