Recently I have come across Web SQL and IndexedDB provided by browsers. I want to understand the use cases when these can be used.
Web SQL is deprecated per https://www.w3.org/TR/webdatabase/.
You can use IndexedDB
if you need to store structured client specific data that you do not store in the server side or you do not want to request from the server every time.
Also as opposed to localStorage
, IndexedDB
is async so it is more performant. It supports indexing resulting in more efficient querying than localStorage
which is simply a key-value store. However, if your needs are simple, localStorage
might be a better option.
Here is a link that talks about different web storage options.
Here is a tutorial about how to use IndexedDB
for a progressive web app.