user2089648
user2089648

Reputation: 1416

Prevent IndexedDb from growing exponentially in chrome

I wanted to try IndexedDB, to see if it is fit for my purpose. Doing some testing, I noticed, that its grow rate seems to be exponentially with every insert.

(Only tested in google chrome version 31.0.1650.63 (Offizieller Build 238485) m / Windows by now)

My Code in full: http://pastebin.com/15WK96FY

Basically I save a string with 2.6 mio characters. Checking window.webkitStorageInfo.queryUsageAndQuota I see that it consumes ~7.8MB, meaning ~3 bytes per character used.

If I save the string 10 times however, I get a usage of ~167MB, meaning ~6.4 bytes per character used.

By saving it 50 times I'm high up in the gigabytes and my computer starts to freeze.

Am I doing something wrong or is there a way around this behaviour?

Upvotes: 1

Views: 271

Answers (1)

Kyaw Tun
Kyaw Tun

Reputation: 13131

Your test is wrong. Field test2 should not be indexed.

Upvotes: 1

Related Questions