Hailey H.
Hailey H.

Reputation: 41

chrome.storage.local vs indexeddb

I have an extension where I need to save a ton of information and access it later. It will average about 1000 entries per day over the last 1-2 years, so ~700,000 items. Each entry will have a date, a unique identifier, a group identifier and a value. I want to be able to access/display the entries by date, by group or individually. Date would be the most used and would need to be the fastest. Is saving them as object in chrome.storage.local fine and just using for key in object and checking values fine or should I use indexeddb for such a task?

The objects look like this.

obj[key] = {date: date, unique: unique, group: group, value: value}

Upvotes: 4

Views: 1347

Answers (1)

WJ Chua
WJ Chua

Reputation: 133

I am sorry that I am a bit late. I have been experimenting with both of these storages for my own extension.

For your situation, since you need to access/display the entries by date, by group or individually, I believe indexedDB will serve you better. IDBObjectStore.createIndex() will enable you to create multiple indexes so that will enable you to retrieve your data in the way you need easier compared to local storage.

As for speed concern, there is this nifty Browser database comparison site that could help you understand the speed difference better.

Upvotes: 5

Related Questions