---
title: "Discussion on \"IndexedDB - Bulk inserts are slow\" | Hashnode"
description: "Discussion on \"IndexedDB - Bulk inserts are slow\". I'm currently building a PWA that needs to persist some data. Lots of data, actually. In my application, I need to store products reference (about 200k of them). An easy task for IndexedDB ? Not so much...\nBulk inserting\nThe IndexedDB api is not grea..."
url: "https://hashnode.com/posts/indexeddb-bulk-inserts-are-slow/620bb0644e82f0219d8fc376"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [IndexedDB - Bulk inserts are slow](https://blog.lekoala.be/indexeddb-bulk-inserts-are-slow?utm_source=hashnode&utm_medium=feed)

I'm currently building a PWA that needs to persist some data. Lots of data, actually. In my application, I need to store products reference (about 200k of them). An easy task for IndexedDB ? Not so much... Bulk inserting The IndexedDB api is not grea...

Feb 15, 2022 · 3 min read · blog.lekoala.be  
Read the article

-   [#pwa](https://hashnode.com/tag/pwa)
-   [#database](https://hashnode.com/tag/database)
-   [#javascript](https://hashnode.com/tag/javascript)

## Written by

[Thomas Portelange](https://hashnode.com/@lekoala)

@lekoala · Belgium

  
[View profile](https://hashnode.com/@lekoala)

A PHP/JS Web Developer based in Belgium

A Web Developer based in Belgium, specialized in PHP &amp; JS development

## Responses 1

Markdown supported · ⌘↵ to post

[Mahmoud Elwan](https://hashnode.com/@mahmoudElwan)

[May 12, 2024](https://hashnode.com/posts/indexeddb-bulk-inserts-are-slow/620bb0644e82f0219d8fc376/comment/6640d68bcad769513acb7160)

Wow, this is a great idea, I've never seen anyone do it before. honestly I'm still a bit surprised that it works 😅 But wouldn't it be better to split your product's info into multiple tables? For example you could create a table that only has the product's name so you can run search queries on it and put a reference in it to other tables that have prices, brands, and other info... This could be easier to manage and also you're not gonna have to write all of the data to Indexeddb at once, you can just write the names that you need to display to the DB. and the rest of the info can be written to the DB in the background while the user browses through your app. If you have other opinions or better ways to do this please share with me your knowledge as I'm currently working on an app with almost the same requirements and it's my first time working with indexeddb 🙏, Thanks again for the great article 🙂.

[Thomas Portelange](https://hashnode.com/@lekoala)

[May 12, 2024](https://hashnode.com/posts/indexeddb-bulk-inserts-are-slow/620bb0644e82f0219d8fc376/comment/6640d68bcad769513acb7160#reply-66411296831350f107b4d0ac)

My use case is that I needed to synchronize a product database. Basically, I get a really big set of data, that needs to work offline.

My first naive approach was inserting them one by one, basically replicating one row per product. But that didn't work, so I ended inserting them as "pages" then dealing with it in memory.

I'm not saying this works for every situation, but for me, it made such a big difference. The app feels really instant and that works really well :)

[Mahmoud Elwan](https://hashnode.com/@mahmoudElwan)

[May 13, 2024](https://hashnode.com/posts/indexeddb-bulk-inserts-are-slow/620bb0644e82f0219d8fc376/comment/6640d68bcad769513acb7160#reply-6642215d2ecffcadc5f3fe7c)

[Thomas Portelange](https://hashnode.com/@lekoala) That's great. Thank you very much for sharing 🤍
