Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

What are Multi-Model Databases?

Posted on Jul 25 • Originally published at Surrealdb.com In today's digital age, staying connected is easier than ever. Social media platforms allow us to remain connected with loved ones, meet new people, and stay updated on world news. However, when the urge arises to reconnect physically or explore a new destination, we go to various applications to book a flight or train effortlessly. Have you ever wondered how all these online and offline applications effortlessly search through all this complex information?To explain that, we need to talk about the intriguing world of databases, where different data models co-exist, much like trains within a bustling metro station.But what is a Data model? A data model is essentially a conceptual framework that determines how data is structured, stored, and manipulated in a Database system. It's like the blueprint of a metro station, defining how trains move, where passengers board, and where cargo gets unloaded. There are several types of data models, each designed to manage data uniquely.Relational modelsPros: They are excellent for handling structured data and complex queries and provide robust transactional consistency (ACID properties). They also support SQL, a powerful and widely-used querying language.Cons: They are less flexible for evolving data needs as changes to the schema can be complex and disruptive. They can be more challenging to scale, which can degrade performance.Document modelsPros: They offer high flexibility as they don't require a predefined schema. They are great for handling semi-structured or unstructured data and can scale horizontally to accommodate large amounts of data.Cons: They are less suited to queries with complex relationships, strict schema enforcement and transactions that span multiple documents. Graph modelsPros: They excel in handling complex and interconnected data. They are also efficient with performing traversals and relationship-heavy queries very quickly.Cons: They are less suited to use cases that don't involve highly interconnected data. They are also less mature than some other types of databases, and there may be fewer tools and resources available to support them.Key-value modelsPros: They are highly performant for read/write operations, especially when access patterns are primarily by key. They can handle large amounts of data and scale horizontally easily.Cons: They offer limited querying capabilities, with the key generally being the only means to access data. They are also unsuited to handle complex relationships or queries across multiple keys.These are just some of the most commonly used models, while more data models cater to particular requirements like the time series data model, columnar data model, etc.The complexity of today's applications vastly differs from what it was a few years ago. Take social media platforms, for instance. They need to handle user profiles, connections, text posts, image data, and user interactions, all of which have different data requirements. Or consider an e-commerce app that deals with inventory, customer data, order history, payment details, and customer reviews.The following query would retrieve the information about an order.But how would you manage semi-structured and unstructured data? A document database can handle semi-structured or unstructured data, like product catalogues and customer reviews.The following query would retrieve all the reviews of a particular product.A Graph database best handles a recommendation system based on user behaviour or interconnected data.A query fetching the names of customers who bought a product and the name of the product they boughtIt is evident that a single data model can not cater to all the features of the e-commerce application or most of the advanced applications today. Your first thought would be to use multiple databases to cater to all these needs. Polyglot persistence is a concept that advocates the use of different databases to cater to different data modelling needs in the same system. While this approach can help you solve the problem of handling inconsistent data, it will introduce multiple challenges on the development side. Some of them would be:Multi-Model Databases provide an alternative approach that aims to solve these challenges.A Multi-Model database is a database that has the features of multiple data models and databases built into a single database. It also has a single query language. This query language can run queries in various ways—relational, document-based, or graph-based—depending on the most suitable approach for your current problem or the type of data stored in your database.Whether dealing with documents, graphs, relational data, key-values, or other data formats, a Multi-Model database can accommodate your data, eliminating the need for complex transformations and migrations between different databases.The beauty of Multi-model databases lies in their adaptability—they mould to your data needs rather than forcing your data to adapt to a rigid structure. Multi-Model databases are often chosen as the primary database when you need to handle multiple data models and don’t want to deal with the complexity of having multiple specialised databases and traditional databases are preferred when you only need a single data model that offers the exact performance and capabilities that you are looking for; as multi-model databases might not cover all the edge cases of every data model. SurrealDB’s architecture is built in a layered approach, effectively separating compute from storage. This facilitates individual scaling of the compute (AKA query layer) and the storage layer as required.The query layer is responsible for handling queries from the client. It intelligently analyses which records must be selected, created, updated, or deleted. The process involves running the SurrealQL query through a parser, an executor, an iterator, and finally, a document processor. Each component plays critical roles, from parsing the query to managing transactions, from determining which data to fetch from the storage engine to processing permissions and alterations.On the other hand, the storage layer manages data storage for the query layer. The flexibility of SurrealDB is evident in its ability to use several underlying storage engines, each providing support for a transaction-based approach. Depending on the mode in which SurrealDB operates - embedded, distributed, or web browser - it uses different high-performing storage engines like RocksDB, TiKV, or IndexedDB, respectively.Coming back to our e-commerce store, here’s how SurrealDB would handle all these requirements using a single query language and within the same database. SurrealDB is a database that does more than storing and query data. With features like Full-Text search, live queries, and in-built security permissions SurrealDB can act as the complete backend layer.Here is a non-exhaustive list of the advantages and features of SurrealDB.SurrealDB is truly the database for the future. It encompasses features that aim to thoroughly change the way you thought of databases. You can learn more details about the future releases and the roadmap of SurrealDB on the website or join us live at SurrealDB World, to help shape the future of the database industry!Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse Cherlock Code 🔎 - Jul 11 Juliana Gaioso - Jul 10 Vishnu Sivan - Jul 1 Moemin Mamdouh 👨‍💻 - Jun 12 Once suspended, surrealdb will not be able to comment or publish posts until their suspension is removed. Once unsuspended, surrealdb will be able to comment and publish posts again. Once unpublished, all posts by surrealdb will become hidden and only accessible to themselves. If surrealdb is not suspended, they can still re-publish their posts from their dashboard. Note: Once unpublished, this post will become invisible to the public and only accessible to Pratim Bhosale. They can still re-publish the post if they are not suspended. Thanks for keeping DEV Community safe. Here is what you can do to flag surrealdb: surrealdb consistently posts content that violates DEV Community's code of conduct because it is harassing, offensive or spammy. Unflagging surrealdb will restore default visibility to their posts. DEV Community — A constructive and inclusive social network for software developers. With you every step of your journey. Built on Forem — the open source software that powers DEV and other inclusive communities.Made with love and Ruby on Rails. DEV Community © 2016 - 2023. We're a place where coders share, stay up-to-date and grow their careers.



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

What are Multi-Model Databases?

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×