indexeddbdexie

Write buffer is failing for large size dexie


I am trying to store parquet file data as buffer in indexeddb, but is failing with no error logged the file size is around 430mb

  const db = new Dexie('database');

  db.version(1).stores({ datasets: 'token,data' });

  const writeStart = performance.now();

  db.table('datasets').put({
    token: `taxi123`,
    data: file.data,
  });

error

But I can overcome it by removing the field data in schema like below and it works:

  const db = new Dexie('database');

  db.version(1).stores({ datasets: 'token' });

  const writeStart = performance.now();

  db.table('datasets').put({
    token: `taxi123`,
    data: file.data,
  });

after success full upload

Wanted to see any error log but which was not found


Solution

  • Please refer to Dexie JS: very large IndexedDB but empty tables

    Basically, large buffers should never be indexed. First because you have no reason to index it. Second because it will make life very hard for indexeddb to maintain the index. You want to store it, yes! But do you want to search for it as a key in a where-clause? Probably no. If you really want to index a large buffer, please store a hash of it in another property and index the hash instead. Remember that you don't need to list all properties in dexie schema, just the ones to index