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 improvement. getAllRecords() effectively combines getAllKeys() and getAll() by enumerating both primary keys and values at the same time. For an IDBIndex, getAllRecords() also provides the record's index key in addition to the primary key and value. getAllRecords() can optionally return records in either ascending or descending order. This option is also back-ported to the existing operations getAll() and getAllKeys().
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. For batched record iteration, for example, retrieving N records at a time, the primary and index keys provided by getAllRecords() can eliminate the need for an IDBCursor, which further reduces the number of JavaScript events required. To read the next N records, instead of advancing a cursor to determine the range of the next batch, getAllRecords() can use the primary key or the index key retrieved by the results from the previous batch. Update the existing operations getAll() and getAllKeys() to support the same query options as getAllRecords(), which adds direction. For some scenarios, getAll() and getAllKeys() may suffice. For example, developers may use getAllKeys() to defer loading values until needed. For records with inline keys, getAll() already retrieves both key and value.
Samples: https://patrickbrosset.com/articles/2024-11-19-even-faster-indexeddb-reads-with-getallrecords https://microsoftedge.github.io/Demos/idb-getallrecords
Explainers: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/IndexedDbGetAllEntries/explainer.md