What's this IndexedDB all about?
This is an emerging technology (2012) that enables web browsers to store a substantial amount of data locally.
It differs from localStorage by being indexed and stored behind the scenes in
a 'real' database. The program can be centrally maintained on the web with no installation hassle while the
user's data stays on their machine.
- Not the same as other databases
- There's no business of connecting to a server.
- It doesn't restrict itself to rigid columns.
- There's no real relational element.
- It doesn't understand SQL.
- The API is rather weird for someone who is used to setting up a query, calling it and processing the response.
Everything is done asynchronously with callback functions. (Yuk!)
There is a simple demonstration here which is a single 'table'.
It is based on a real-life, single-user application being migrated from Delphi/Paradox with 20,000 records.
- It imported 400 records a minute on a Pentium 4 which isn't all that fast but OK for many things.
- The limited functionality is actually what was required by the end-user.
- There's no attempt to make this cross-browser compliant. The end-user has Firefox so I'm happy.
- This doesn't use blobs but some implementations support them.
localStorage is a better bet for applications with small amounts of data.
(And a great deal easier for a programmer to use.)
indexedDB is tricky to get the hang of for someone used to traditional
database APIs. I used the event-driven approach but next time I'll try using it synchronously.
I'll investigate wrappers that make indexedDB simpler to use, because I like the idea of installation-free