1

PROBLEM: I know there is a limit to the number of records (2^32 - 1 per Mozilla) that can be returned from IndexedDB, but what about data? I am having a problem with IDBIndex.getAll(), or IDBObjectStore.getAll() for that matter, throwing a generic error whenever the amount of data apparently exceeds a certain size.

 "DOMException: The operation failed for reasons unrelated to the database itself and not covered by any other error code."

I am using Firefox, and this has been an issue for a while.

EXAMPLE:

... open the database, etc ...
let index = db.transaction("database").objectStore("myStore").index("myIndex");
let range = IDBKeyRange.lowerBound(100000);  // That's just a random number for the example
let results = index.getAll(range);
results.onerror = e => {...};
results.onsuccess = e => {...};

That will always throw an error. But if I change the range to IDBKeyRange.lowerBound(100001), it always works.

TESTS: If I were to turn lowerBound into upperBound (and change the range), the number of records returned without throwing an error would change, but that number would be consistent. Since not all records have the same amount of data, and the number of records returned in each case is fairly close (19,844 vs 20,188), that seems to support my assertion. The same thing happens if I change the index, just a different number of records.

Edit: I tested the database on another machine and I got a different maximum number of records returned, but that number was consistent as well.

I've also tried closing programs, thinking maybe it's a memory issue, and changing the size of my database by adding or removing a significant number of records, but that has had no effect on the results returned.

As a workaround, I am currently using openCursor() to evaluate each record individually, but that is slower than using getAll() since I want all the data from each record that satisfies the query.

Any ideas what's wrong and how to fix it?

See related problem that was never solved

Daniel H
  • 443
  • 3
  • 14
  • I think you're right and there's nothing that can be done about it. I also use openCursor when it's going to be a large amount of records returned. – dumbmatter Nov 14 '21 at 05:31
  • @dumbmatter Apparently this wasn't an issue for me 4 years ago: https://stackoverflow.com/questions/44349168/speeding-up-indexeddb-search-with-multiple-workers – Daniel H Nov 16 '21 at 05:17

0 Answers0