



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This file is a series of information on how information is stored in a noSQL database and the suitable formats of storing the files.
Typology: Lecture notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Lecture 4: Types of NoSql Databases There are four kinds of NoSQL databases: i). document databases e.g Mongo DB, XML Native DB ii). key-value stores e.g. Amazon DynamoDB, ScyllaDB, iii). column-oriented databases: Apache Cassandra iv). graph databases. The db language of NoSQL data bases differ depending on file storage type e.g XML Native DB uses XQUERY, MongoDB uses Javascript etc Document Databases This type of data model allows you to store information as any type of data. This is in contrast to SQL, which relies heavily on XML and JSON, and essentially ties the two together, and can make any query inefficient (or less efficient). Since NoSQL doesn’t use a scheme, there’s no need for relational data storage, and no need to tie those two together. there is a NoSQL data model that is XML specific, if you want to go that route. The document-based database is a nonrelational database. Instead of storing the data in rows and columns (tables), it uses the documents to store the data in the database. A document database stores data in JSON, BSON, or XML documents. Documents can be stored and retrieved in a form that is much closer to the data objects used in applications which means less translation is required to use these data in the applications. In the Document database, the particular elements can be accessed by using the index value that is assigned for faster querying. Collections are the group of documents that store documents that have similar contents. Not all the documents are in any collection as they require a similar schema because document databases have a flexible schema. Key features of documents database: Flexible schema: Documents in the database has a flexible schema. It means the documents in the database need not be the same schema. Faster creation and maintenance: the creation of documents is easy and minimal maintenance is required once we create the document.
No foreign keys: There is no dynamic relationship between two documents so documents can be independent of one another. So, there is no requirement for a foreign key in a document database. Open formats: To build a document we use XML, JSON, and others. Key-Value Stores: A key-value store is a nonrelational database. The simplest form of a NoSQL database is a key-value store. Every data element in the database is stored in key-value pairs. The data can be retrieved by using a unique key allotted to each element in the database. The values can be simple data types like strings and numbers or complex objects. A key-value store is like a relational database with only two columns which is the key and the value. Key features of the key-value store: Simplicity. Scalability. Speed. Key-value databases are highly partitionable and allow horizontal scaling at scales that other types of databases cannot achieve. For example, Amazon DynamoDB allocates additional partitions to a table if an existing partition fills to capacity and more storage space is required. NB: Horizontal Vs Vertical Scaling: horizontal scaling is adding more database nodes (storage locations in a network) while Vertical scaling is adding more storage to an existing database (in the same computer) The following diagram shows an example of data stored as key-value pairs in DynamoDB.
Session store: A session-oriented application such as a web application starts a session when a user logs in and is active until the user logs out or the session times out. During this period, the application stores all session-related data either in the main memory or in a database. Session data may include user profile information, messages, personalized data and themes, recommendations, targeted promotions, and discounts. Each user session has a unique identifier. Session data is never queried by anything other than a primary key, so a fast key-value store is a better fit for session data. In general, key-value databases may provide smaller per-page overhead than relational databases.
When to use the Columnar Database:
there could be multiple user data elements but the relationship is what is going to be the factor for all these data elements which are stored inside the graph database.