DEV Community

Discussion on: IndexedDB: Caching your data on the client side

Collapse
 
akashkava profile image
Akash Kava

It's really pain to work with IndexedDB, WebSQL with Sqlite was way better as it had so many features, IndexedDB is extremely limited and it requires too much of work (all asynchronous), where it could be done in simple single SQL statements with joins.

Collapse
 
roelofjanelsinga profile image
Roelof Jan Elsinga

I can definitely understand that it's difficult to work with since it's all asynchronous. However, most of my applications are fully asynchronous, leveraging Promises and Observables, so in this context, it's quite easy to implement another asynchronous functionality. I do understand where you're coming from though because this was something I struggled with when transitioning some parts of my application from localStorage to IndexedDB. It's all about what your current workflow is like and if this solution fits with your application.

Collapse
 
akashkava profile image
Akash Kava

Async was never problem, but trying to figure out joining, indexes, is like reinventing SQL inside a browser, which SqLite is already wonderful at. It is waste of time. I feel IndexedDb is no match for WebSQL, I wonder why Mozilla opposed it, and that brought down support for WebSQL. We did make a whole email client using WebSQL in browser and it worked charm, trying to convert it to IndexedDb was nightmare.

Thread Thread
 
roelofjanelsinga profile image
Roelof Jan Elsinga

I don't think the two are comparable in the way you're thinking. It's like comparing an SQL database to a document-based database like MongoDB. They both have their uses and they're both good at something else. I can understand why it's a nightmare trying to convert an application from one to the other, the approach to developing with the two are very different. Joining isn't a thing with IndexedDB, because all the data is in a nested JSON object, so it's simply not necessary.

Thread Thread
 
akashkava profile image
Akash Kava

Not necessary? Nested JSON is not fit for all problems, Reporting and investigating various relationships is easy in RDBMS, for such problems WebSQL should have been supported, you can't throw up NoSQL for all business models.

Thread Thread
 
pattisano profile image
Philip Attisano

This is an old conversation but still holds true in 2021! Relational databases are going strong after nearly 50 years! Refusing to support one in the browser just because SQLite was the de facto standard is imo a bad decision.