v133 · offline / storage
IndexedDB getAllRecords() and direction option for getAll()/getAllKeys()
This feature adds the getAllRecords() API to IndexedDB's IDBObjectStore and IDBIndex. It also adds a direction parameter to getAll() and getAllKeys(). This functionality enables certain read patterns to be significantly faster when compared to the existing alternative of iteration with cursors. One key workload from a Microsoft property showed a 350ms imp
concepts
-
getAllRecords
Bulk reads with key+value records and direction option.
-
Cursor vs getAllRecords
The 350ms Microsoft benchmark, reproducible in-page. Seed N rows, run the cursor loop and
getAllRecords()side by side, see the speedup. -
Range query builder
Combine
IDBKeyRange, the newdirectionoption, andcountagainst a 5000-row demo store. Live results, timing, and a paste-ready snippet. -
Paginated reader
Seed a real IndexedDB store (up to 2000 records), then page through it forward or backward using
getAllRecords()with thedirectionoption. Compares timing against a cursor fallback on every page load, with a side-by-side timing bar showing the speedup. -
Search index
A client-side full-text search engine: seed up to 2000 articles into IndexedDB, then type to search titles and body text.
getAllRecords()bulk-fetches all rows in one shot for JS-side scoring; a cursor fallback does the same scan record-by-record. Side-by-side timing bars show the difference as the corpus grows.
why it shipped
Decrease the latency of database read operations. By retrieving the primary key, value and index key for database records through a single operation, getAllRecords() reduces the number of JavaScript events required to read records. Each JavaScript event runs as a task on the main JavaScript thread. These tasks can introduce overhead when reading records requires a sequence of tasks that go back and forth between the main JavaScript thread and the IndexedDB I/O thread.