What is IndexedDB?

Laptop

The first thing to understand is that IndexedDB is just a database that is built into some browsers, primarily the Google Chrome browser. But, other browsers also have analogues of such a database.

IndexedDB is a noSQL database. We can not make SQL queries to the database. Make any selections with SQL syntax queries. We can communicate with this database with the help of so called API interface, which this database has.

The interaction is done through the execution of certain commands. To add something there, to delete or to update it. IndexedDB is an object-oriented database. It’s very similar to document-oriented databases.

In such databases, information is stored in the form of documents. Documents are represented as objects. Objects are just JSON objects. With which we can somehow interact.

Objects are usual JSON objects which contain information as key + value.

Objects can have a complex nested structure.

If we have such information stored there, there can’t be relationships in such a database – it’s not a relational database. It also doesn’t have the tables that relational databases have. Such as MySQL, PostgreSQL, etc.

There are only objects here that we can interact with.

In IndexedDB you can store strings, numbers, dates, objects and even files.

IndexedDB has a fairly high data processing speed. This speed is much faster than the same relational databases.

As for the amount of data we can store in this database, there is almost no limit to the size and we can store millions of records, no problem. This is calculated by a complicated formula, but it’s about 50% of the free disk space.

But, there are disadvantages to this database. One of those disadvantages is that the data is stored on the client side. That is, the data is stored in the browser in which you are working.

This is a big disadvantage and you’re tied to the browser you’re working on. There are options for how you can sync information between different browsers. But, by default, you are limited to the browser in which you work.

Accordingly, the scope of such databases is somewhat limited and usually applied to development. That is, if you are not going to publish your application in production, ie on some server to make it available on the Internet, then for the development environment you can use this database.

I.e. quickly create some application that will work in your browser.

Another application is the development of browser extensions.