1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

bulkPut operation on DexieDb takes increasingly long time, even though it is cleared before...

Discussão em 'Angular' iniciado por Leska, Outubro 1, 2024 às 10:52.

  1. Leska

    Leska Guest

    I am using Dexie to store data in an Angular app. The db has a simple schema with a suitable primary index and a secondary compound index. The user can manually trigger redownload of data, which clears the db and inserts fresh data. The download time is consistent, but the time taken to perform the bulkPut operation on Dexie/IndexedDB increases for each call, even though the items to insert are exactly the same and the db is cleared before each insertion.

    fetch data . . .

    await table.clear();
    console.log('Count after clear: ' + table.count());
    console.time('bulkPutOperation');
    await table.bulkPut(data);
    console.timeEnd('bulkPutOperation');
    console.log('Count after bulkPut: ' + table.count());


    I have verified that the count of items in db is zero before every re-insertion:

    Count after clear: 0
    bulkPutOperation: 3029.259033203125 ms
    Count after bulkPut: 9346

    Count after clear: 0
    bulkPutOperation: 7922.09814453125 ms
    Count after bulkPut: 9346

    Count after clear: 0
    bulkPutOperation: 10799.208984375 ms
    Count after bulkPut: 9346


    What could be causing this, do I have to delete the db before re-inserting?

    Continue reading...

Compartilhe esta Página