Smart technology for a strong manufacturing industry with 24/7 uninterrupted production of IIoT solutions for companies.
In a key-value database, every entity is a set of key-value pairs. In contrast to RDBMS databases, objects (or records) in a key-value database may have different fields for each record. This provides tremendous flexibility and conforms more to modern concepts like object-oriented programming.
In addition, optional attributes are in general not stored in a key-value database and hence they tend to use less memory to store the same data as opposed to RDMBS databases.
Key-value databases can use different consistency models (e.g. eventual consistency) and some maintain data in memory (RAM) while others use solid-state drives or rotating disks.
Most key-value stores are also distributed or ‘sharded’. This means that they are specifically designed to enable horizontal scaling instead of vertical scaling and can be extended with additional ‘shards’ to store more data. Sharding data however brings back the question of consistency and decisions will need to be taken on how to apply which consistency model.
In a true key-value store queries can only be done through the key or through components of the key. It is not possible to query directly on the contents of the value or create complex queries on the data contents.
That’s where object stores a.k.a. document-oriented databases come in. They are a special kind of key-value stores that extend the functionality of a pure key-value store with additional powerfull query capabilities on the content of the data.
As said before, there’s no 1 ring to rule them all: it all depends on the use case.
While key-value databases are powerful, there’s no standard like with RDBMS databases and each kind of key-value database is designed differently to cope with multiple requirements.
Advantages:
Extremely fast for simple lookups
Scalable (horizontally, through sharding)
Flexible schema
Low latency (often in-memory)
Disadvantages:
No complex queries or relationships
Limited filtering capabilities
Data duplication when modeling complex structures
Caching (e.g., Redis as a session store)
Real-time recommendation systems
Storage of configurations or session data
Document-oriented databases are actually specialized key-value stores.
Examples of NoSQL document-oriented databases are MongoDB, Microsoft Azure CosmosDB and Couchbase.
We call these databases document-oriented, not because they contain documents like pdfs or word documents but because they fully support a document-like format. Full-fledged document-oriented databases dispose of powerful query capabilities which sets them apart from the previously mentioned key-value stores.
The central concept of a document-oriented database is the notion of a document or object. Documents encapsulate and encode data in some standard format or encoding. Encodings frequently encountered are XML, YAML, JSON as well as binary forms like BSON.
The flexible, semistructured, and hierarchical nature of documents and document-oriented databases allows them to evolve with applications’ needs.
Objects in a document-oriented database are not required to adhere to a standard schema, nor will they have all the same sections, properties or keys. Generally, programs using objects have many different types of objects, and those objects often have many optional fields. Every object, even those of the same class, can look very different. Document stores are similar in that they allow different types of documents in a single store and allow the fields within them to be optional. Even multiple encodings are possible for the same class so that one object could be stored in JSON encoding while another could be stored in XML encoding.
Advantages:
Flexible schema (easy to add new fields)
Good performance with hierarchical or nested data
Easy integration with web and mobile apps (JSON)
Horizontally scalable
Disadvantages:
Less suitable for complex transactions or joins
Possible data duplication
Usually eventual consistency when document structures are modified
Content management systems
Web applications using JSON data
Event and logging data